Detect variant change by user on storefront

Highlighted
Shopify Partner
49 1 10

Hi,

I am looking for a good way to detect the variant change by user while they are on product page. Keeping in mind that there are lots of themes and all would have different structures, what would be an optimal way to detect that change from a ScriptTag JavaScript??

Thanks.

0 Likes
Highlighted
Shopify Partner
280 29 55

Hi,
Yes, IavaScript is the only way to detect change event!

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
0 Likes
Highlighted
Shopify Partner
49 1 10

Okay, but how? have you done anything similar?? If yes, would you please like to share :)

 

Thanks.

0 Likes
Highlighted
Shopify Partner
49 1 10

Upon further digging, it seems that all Shopify themes use this approach of chaning a hidden select with name="id" when changing the variant. But that select element is not responding to any kind of change event. Please, any help here guys?

0 Likes
Highlighted
Excursionist
58 2 1

did you work this out?

0 Likes