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
Shopify Staff
2723 289 743

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