Re: Show badge on products with specific tags

Show badge on products with specific tags

ewancastle
Shopify Partner
6 0 0

I'm currently running a specific promotion on certain products, and to highlight this, I'm adding a small badge on the bottom left of the product image on collection pages.

 

I'm currently running the following code:

 

{% if collection.title contains 'Multibuy' %}
  <span class="card__badge bottom left" style="background-color:#a7c5e5;">MULTIBUY</span>
{% endif %}

 

But I want to replicate this onto other collections that contain products that have the tag "Multibuy", I tried to use the following code but it doesn't work:

 

{% if product.tags contains 'Multibuy' %}
  <span class="card__badge bottom left" style="background-color:#a7c5e5;">MULTIBUY</span>
{% endif %}

 

Would appreciate any help with this as I'm unsure what else to do to get working.

Ewan Castle
Replies 6 (6)

KlaudiaW
Visitor
2 0 0

Not sure if you are already aware of it, but just throwing it out there as it's not very obvious.

Depending on the theme you are using, sometimes the variables in your product-card.liquid file may refer to the product in a different way than "product". So check for that specifically. I have seen different variations, in the two themes I'm using for my stores, it's "product_card_product" and "prod". So in my case, it would say {% if product_card_product.tags contains 'Multibuy' %}

KlaudiaW_0-1721160955749.png

 

 

Dan-From-Ryviu
Shopify Partner
9537 1918 1954

Hi @ewancastle 

What theme your store is using? 

- Helpful? Like and Accept solution! or Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

ewancastle
Shopify Partner
6 0 0

Hi, I'm using Dawn theme.

 

I've placed this code in card-product.liquid

Ewan Castle
JasmeetVT14313
Shopify Partner
273 59 72

Hi @ewancastle 
Let me know if you need my assistance.

- VTN Customer Dashboard enhances your customer's dashboard with advanced features, profile management, and order tracking. Free trial available.
- Feel free to contact me at [email protected]

JasmeetVT14313
Shopify Partner
273 59 72

Hi @ewancastle 
As this might need multiple file updates, is it possible for you to provide collaborator access? I can do it for you.
Any further queries or concerns you can DM me.

- VTN Customer Dashboard enhances your customer's dashboard with advanced features, profile management, and order tracking. Free trial available.
- Feel free to contact me at [email protected]

Amanda_Fordeer
Shopify Partner
110 8 29

@ewancastle,

You can consider using third-party apps like Product Badges & Labels, which will assist you in creating product labels with specific collections and tags.

 
If you find my suggestion helpful, please give it a like or mark it as a solution!
And discover more approaches to:
Streamline invoicing process Boost sales with labels & badges Add social proofs & create FOMO
Or get valuable updates and private deals regarding Shopify here.