How to customize a textbox for a specific product in Dawn theme?

Solved

How to customize a textbox for a specific product in Dawn theme?

KevP
Tourist
7 0 0

I have some dev experience and I'm playing around customizing my own site from the Dawn theme. I had an issue where I needed a textbox for a specific product so I made a textfield input for it, but I realized it shows up to all of my products. How can I make it only for a specific product?

 

Right now I have a custom Liquid for the textbox

Accepted Solution (1)
GemPages
Shopify Partner
5625 1262 1279

This is an accepted solution.

Hi @KevP ,

 

There is a misunderstanding here. You should replace {{YOUR_TEXTBOX_CODE}} with your code.

 

It should look like that

{% for tag in product.tags %}
{% if tag contains 'show-textbox' %}
<label for="message" class="form__label">Tell us what your secret message will be!
</label>
<div class="field">
  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>
</div>
{% endif %}
{% endfor %}

 

Best regards,
GemPages Support Team

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center

View solution in original post

Replies 3 (3)

GemPages
Shopify Partner
5625 1262 1279

Hello @KevP ,

 

It's GemPages support team and glad to support you today.

 

In this case, you can add a tag (eg: show-textbox) for the products that you want to show the textbox.

 

After that, you could please try using format code:

{% for tag in product.tags %}
{% if tag contains 'show-textbox' %}
{{YOUR_TEXTBOX_CODE}}
{% endif %}
{% endfor %}

 

Best regards,
GemPages Support Team

 

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center
KevP
Tourist
7 0 0

Hi thank you for the reply, I just added the tags and formatted the code using the for loop logic you provided and I am getting syntax errors. Today is my first day seeing Liquid language/syntax, sorry. Should I assume this goes to a .liquid file when I "edit code"?

{% for tag in product.tags %}
{% if tag contains 'show-textbox' %}
{{<label for="message" class="form__label">Tell us what your secret message will be!
</label>
<div class="field">
  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>
</div>}}
{% endif %}
{% endfor %}

 

GemPages
Shopify Partner
5625 1262 1279

This is an accepted solution.

Hi @KevP ,

 

There is a misunderstanding here. You should replace {{YOUR_TEXTBOX_CODE}} with your code.

 

It should look like that

{% for tag in product.tags %}
{% if tag contains 'show-textbox' %}
<label for="message" class="form__label">Tell us what your secret message will be!
</label>
<div class="field">
  <textarea id="message" class="text-area field__input" placeholder="Message" name="properties[Message]"form="product-form-{{ section.id }}"></textarea>
</div>
{% endif %}
{% endfor %}

 

Best regards,
GemPages Support Team

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center