What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Javascript code (Script Tag) Getting the selected variant id on a product page in Shopify Theme 2.0

Javascript code (Script Tag) Getting the selected variant id on a product page in Shopify Theme 2.0

khegde
Shopify Partner
2 0 0

Hello,

Can anyone help me on a javascript code to get the selected variant id in a product page for Shopify Theme 2.0.

regards

Kaushik

Reply 1 (1)

Liam
Community Manager
3108 344 895

Hi Kaushik,

 

Are you looking to set up your product page so that when you select a specific variant, the main image of the variant is displayed? The actual code for this will depend on which theme you're using (and also which version of the theme). Which theme and version are you looking to make this customisation on?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog