Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Changing visible input boxes depending on button press

Changing visible input boxes depending on button press

JRomero1
Visitor
1 0 0

Hello. I have an issue. On our website, we take multiple inputs from the customer. We're trying to find a way to change the number of textboxes customers can see depending on which variant of the product they pick. For example, on this page:

https://luxeengravable.com/products/personalized-wallet-initial-impression?variant=46404071883051 

 

When the customer has selected the front initial option, only the input box for initials should be present, with both the input boxes for initials and message being visible only when the other option is chosen. How can I hide the message input box when the user has selected the initials only variant of the product?

Reply 1 (1)

gr_trading
Shopify Partner
1948 145 204

Hi @JRomero1 

 

You can create a metafield at variant level which will contain the I'd of div contains the input.

 

Now write a script code on variant change get the metafield I'd and show it and hide others.

 

Hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee