Shopify Buy Button - Fetching variant_id

codyb13
Excursionist
14 0 3

Hi -- how can I retrieve the variant_id of a product using BuyButton.js? I see the product_id, but I'm not sure where I can access the variant_id using the methods available. 

It seems like the object returned by `ShopifyBuy.UI.onReady(client)` has a property that might contain the variant_id, but I cannot seem to find it. 

Context: I want to dynamically add code to the component depending on which variant is selected. 

 

0 Likes