I have a product with size variants (i.e. Small, Medium, Large). I need to know what size the user has selected on the ProductPage. I can easily get all the possible sizes using GetProduct() but i cannot figure out how to detect what size the user has currently selected in the product options dropdown.
I added by own add to cart button and use some logic and then add to cart as follows:
$w(‘#shoppingCartIcon1’).addToCart(productId , qty, {“choices”: {“Size”: size}})
But as you can see i need to know what size the user selected
Any idea how i can read the current selected size by the user?
Hey
You can’t, that is the simple answer. The getProduct will give you all but not after selections only after loaded. So you will have to do your own product page and then you can solve that. I did that and it works like a charm.
Is there a way i can hide or interact with exiting elements on the standard pages pragmatically without creating my own full products page?
For now all I need to do is Hide the size dropdown but I dont have a way to interact with its properties.
I added my own Dropdown to the Products page and put it on top of the exiting dropdown so all i need os a way to hide the default element.
Any idea how I can get access to the individual elements within the standard page (image, dropdown, etc…) pragmatically?
Wow, I am just came across the same problem and it seems nothing changed in the last 4 years. Would be good if the ProductPage widget would be more flexible when it comes to its customization and the data it shares through its API (knowing what variant is selected is key).