Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Update Selected Variant on Option Change

Update Selected Variant on Option Change

axwaxw
Visitor
2 0 0

Products in my store have a number of options, but not all options are available for all products.

 

For instance, there are 2 'fabric type' options, each of which has its own selection of color options.

 

If the customer selects a 'fabric type' and 'color', but then changes the 'fabric type', the selected variant does not automatically update and the selected option is displayed as crossed out (i.e. unavailable ) see screenshots below.

 

On change of and OPTION, I would like the VARIANT to update automatically to the first available VARIANT having all of the selected OPTIONS (unless the currently selected variant is still valid).

 

Can this be achieved through javascript / liquid?

 

The examples I have seen are triggered by change of VARIANT, but I want to trigger a VARIANT UPDATE on change of OPTION.

 

Thanks!

 

 

FABRIC TYPE AND COLOR SELECTED FIRST - AND VARIANT UPDATES

 

shopify1.png

FABRIC TYPE OPTION UPDATED BY USER - BUT SELECTED VARIANT DOES NOT UPDATE AND COLOR OPTION IS DISPLAYED AS CROSSED-OUT (I.E. UNAVALABLE)

 

shopify2.png

Replies 2 (2)

shahrozbabar5
Shopify Partner
262 22 31

@axwaxw Well, I understood why it is happening, it would need custom code, let me know if you are familiar with JavaScript or liquid. I can guide you here but if you are familiar with the code or will not mess up the whole theme. else I can fix this issue for you. let me know your response, so I can further answer

Need a Shopify Expert and Specialist? Let's chat on WhatsApp and bring your vision to life!


Custom Shopify Store Design | Premium Themes | Variant Apps Expert


Your Coffee Tip and my code, a seamless synergy. ❤️

axwaxw
Visitor
2 0 0

@shahrozbabar5 thanks - yes I am familiar with liquid and javascript.  I have tried various solutions that are triggered by a change in variant but I have not yet found a solution triggered by a change of option, nor am I able to find a way to get the currently selected options (only the currently selected variant).  Any assistance appreciated!