How can customers manage tag names via the backend in Shopify?

Hello Shopify friends,

I am currently working on making it easier for my customer to manage tags/badges via the backend. (see attached)

Code working:

{% for tag in product.tags %}
{% if tag contains “Bestseller” %}
{{ tag }}
{% endif %}
{% than before %}

which works fine, but I would like the customer to be able to enter the tag name themselves in a text field via the backend. So I tried putting “{{ section.settings.badge_name }}” instead of “Bestseller” but it doesn’t work.

Code not working:

{% for tag in product.tags %}
{% if tag contains “{{ section.settings.badge_name }}” %}
{{ tag }}
{% endif %}
{% than before %}

Does anyone have a solution to this problem..?

Cheers // Peter

Hi @BayOfDenmark

can you try the below code?

{% for tag in product.tags %}
  {% if tag contains section.settings.badge_name %}
     {{ tag }} 
  {% endif %}
{% endfor %}

Also, you should define the badge_name setting in your schema block like this

{
  "type": "text",
  "id": "badge_name",
  "label": "Badge Name",
  "default": "Bestseller"
}

Hi Okur90, you are a superstar! Thanks! it works :grinning_face:

Thanks for the quick response!

Cheers // Peter