I’m trying to show my “Embossing” textbox only when the “Style” dropdown option “Embossing” is selected. I’ve added the below code in my new template, product-customizable-template.liquid, which created the textbox but I want to hide it unless “Embossing” is selected.
@prinpadure , I can’t thank you enough, I was almost there but your code got me there, thank you!
This is for anyone looking for a similar solution. . .
I didn’t mention that I had a stamp option as well, so I included that into the code. I also wanted the Embossing (and Stamp) textboxes hidden right from the start, so I went to “myproduct-customizable-template.liquid” template and added the “hidden” at the end of the classes (<p . . . hidden>) of my emboss and stamp textboxes, then called them to display in the code, instead of having them displayed and hiding them. Now, when I enter the page, the textboxes are hidden automatically, and whatever option that is selected will display the correct textbox. I also changed them to be variables because they may be changed.
//Hide Embossing/Stamp
document.getElementById("SingleOptionSelector-0").onchange = function () {
var elementEmboss = document.getElementsByClassName("line-item-property__field")[0].style
var elementStamp = document.getElementsByClassName("line-item-property__field")[1].style
if (this.selectedIndex == 1) {
elementEmboss.display = "block"
elementStamp.display = "none"
} else if (this.selectedIndex == 2) {
elementStamp.display = "block"
elementEmboss.display = "none"
} else {
elementEmboss.display = "none"
elementStamp.display = "none";
}
}
Im a new Ecommerce dropshipper Im still developing my own brand. also, for the product pages when you want to select the color option I want there to be a button called “Select” can anyone help me with this option
The Easify Product Options app can fully meet your needs — not only by allowing you to show or hide specific fields (like “Embossing”) based on the customer’s selection, but also by letting you set up advanced conditional logic, add custom add-on prices for each option, and even personalize the display layout to perfectly match your store’s style — all without touching a single line of code.
Here’s an example I’ve created so you can see how it works:
The app offers a smooth and user-friendly experience for all your customizable products. Plus, the Easify team is always available to lend a hand whenever you need it.