All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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.