Liquid, JavaScript, themes, sales channels
Hello,
I'm trying to get the Option 1 variant value on the product page, and depending on what is selected, I would like to render a specific header for Option 2.
I would ideally like to do this without deeplinking. Is there a way to set an outer variable, or use javascript/jquery to get the "is-selected" element?
You'll probably have to go through JS here. I usually like to render all elements that might be displayed at any point and hide them upon page load. Depending on what option is selected, I then do the show/hide toggling through JS. Makes sense?
Mario
Hey appreciate the reply, I'm still a little confused and completely new to liquid. In what file do I put the javascript? The toggling makes perfect sense but still stumped on how to get the value of the Option 1 selection.
To clarify, I have 2 options, Option 1 can be "iphone" or "iphone charger". If Option 1 is "iphone", I want Option 2 to be labeled something, if Option 1 is "charger" then i want option 2 to be labeled something else. How do I know/get what the value of Option1 is?
Hi @MelonCiroc
how do you define the labels for option2? Wouldn’t they need to be defined in the context of option1 as they depend on it? How many different ones are there?
if you’re not a programmer yourself, it’s gonna be hard explaining this to the point where you can build it. I can build that, but I’d need access to the code and depending on the existing code it might exceed what I can offer here pro bono.
Mario
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024