Generate variant ID based on selected Size and Color swatches

Solved
Highlighted
Tourist
15 0 2

Is there any way I could generate variant ID of a combination of selected Size and Color swatches using javascript? 

0 Likes
Highlighted
Excursionist
32 4 9

This is an accepted solution.

Hey @cedrichadjian, I don't believe you could generate a variant ID out of size and color values, but you can definitely assign the {{ product | json }} object somewhere, and use the variants object inside to find which variant has the current values (if any) using JS. This is the basis of most product configurators I develop.

0 Likes
Highlighted
Tourist
15 0 2

Thank you. That works!

0 Likes