All things Shopify and commerce
Ok so basically I have
{% if product.selected_variant == 'text' %}
<label> 1st side text </label>
<input required type = "text" id="custom-side1-name" form="{{ product_form_id }}" name="properties'[]"[Your Name] />
{%- endif -%}
It is a custom engravable cup website where I would like to be able to turn off a text box input if I select the option monogram.
Anyone have the same problem/know what to do?
Hi there!
You will need JavaScript for this that will show/hide the text input depending on the variant. The solution really depends on the rest of the theme code. I would advice hiring a developer to perform this.
If hiring a developer is not an option, then I would advice that you separate monogrammable products from the ones that are not monogrammable. Once that is done, follow these steps (note that these steps are made for the Dawn theme):
{% if template.suffix == 'monogramming' %}
<label for="custom-side1-name">1st side text</label>
<input required type="text" id="custom-side1-name" name="properties[Your name]" />
{% endif %}
The main con of this approach is the separation of the products. The other problem is that monogrammable products can still be submitted without any name entered.
If you need a more custom solution, please message me directly.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025