Changing selected variant with Javascript

anrath
New Member
2 0 0

I want to create a function that switches the selected variant so I can connect it with a button. How can I modify the selected variant using Javascript?

Replies 3 (3)
LitExtension
Shopify Partner
3340 659 721

Hi @anrath,

Can you explain more about it, you want to check when variant changes and add function to it.

Please send me site link, I will help you check where JS is added to the changed variant.

Hope it helps!

 

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
anrath
New Member
2 0 0

I do not want to "check when variant changes and add function to it." I want to write a function that changes which variant is selected without just redirecting to another page on the website. 

 

The production version of the website doesn't have any relevant code to this question currently. I've been working in a copy of the theme.

LitExtension
Shopify Partner
3340 659 721

Hi @anrath,

Please send your site and if your site is password protected, please send me the password. I will check it.

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!