How i get an information from the product selling price and pass to a react component?

Vtex io make a map of an array of products, and in some points it render the price of ich product to me, by using
“product-selling-price#summary”: {
“props”: {
“blockClass”: “summary”
}
}

I need to pass this dynamic information to a react component, but when I try something like:
“react-component-example”: {
“props”: {
“anyprops”: “{ “product-selling-price#summary”}” // or “{savingsValue}”
}
}

I’m getting in return only the text and not the real information (like the text “savingsValue” or another and not the price $10). How do I get this information properly, please?

Hello!

I think you can use the useProduct hook. That hook can be used in a component inside a PDP to retrive information about the product.

Let me know if this helps! :smiley:

2 Likes

Hi @Marinho
In Addition to what @gabrielHosino just suggested you also have GraphQL Apis through which you can access the price range, list price, and selling price.

[GitHub - vtex-apps/store-graphql: GraphQL schema and resolvers for the VTEX Commerce Stores API](https://Store Graphql)
You can add the dependency and can start using the Queries.

Regards,
Tanishq

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.