How can I add specific badges to certain products?

noemi2
Pathfinder
100 1 24

Hi, I would like to have two badges: sold out and out of the season. Do you know how I can do it? I already have tried the app BSS: Product Labels & Badges but I couldn't create a badge for only some products. Thank you in advance.

Replies 3 (3)

Ritu-25
Shopify Partner
129 26 15

Hello @noemi2 , 

For creating badges for specific products you can use the product tags. 

Follow below steps: 

Add this code in "main-product.liquid"  after the title and save it. 

Ritu25_0-1707979215527.png

 

 

 

<div class="badge">
              {% for tag in product.tags %}
                {% if tag contains 'badge' %}
                  {% assign final_tag = tag | remove: 'badge_' %}
                    {{ final_tag }}
                  {% endif %}
              {% endfor %}
            </div>

 

 

 

Once you save the code then you need to go to the product where you want to add the badge. 

 

 

Thanks, 

Ritu 

If helpful then please Like and Accept Solution.
You can directly PM.
Email Me : nayakritu.2506@gmail.com
noemi2
Pathfinder
100 1 24

k you very much for your help @Ritu-25 

I do not have any main-product.liquid. I have product.liquid, product-template.liquid, product-meta.liquid and product-item.liquid.

In product-meta.liquid is the only place where I found something related to the product title. See attached. Is the correct place?

 

Captura de pantalla 2024-02-16 a las 23.09.49.png

Ritu-25
Shopify Partner
129 26 15

Hey @noemi2 , 

 

Please add the code after title is showing. 

If our code woudn't refelect there then i need to check which file is calling out there. 

could you please let me know which theme you are using currently? 

 

Thanks, 

Ritu 

 

If helpful then please Like and Accept Solution.
You can directly PM.
Email Me : nayakritu.2506@gmail.com