hi i am trying to add a ‘new’ badge to my shopify store ( i work with dawn theme)
i manage to add the ‘new’ badge to the card product in the collection page and carusal
but i didnt succes to add it to the product page / main-product
even try to add it to the price liqud where it shows the badge of discount
this is the code i am using for the collection page that work:
{% if card_product.tags contains ‘חדש’ %} חדש
{% endif %}
To add the ‘new’ badge to the product page in your Dawn theme, you need to modify the code in the main-product.liquid (or similar template file) to check for the tag and display the badge.
Here’s how you can do it:
Locate the Product Template File:
In your Shopify admin, go to Online Store > Themes > Edit Code.
Open the file sections/main-product.liquid (or similar, depending on your theme version).
Add the Badge Logic:
Search for where the price is displayed or near the discount badge code.
Insert your badge condition where appropriate. For example:
{% if product.tags contains 'חדש' %}
חדש
{% endif %}
Style the Badge:
Go to Assets > base.css (or theme.css) and add styling for .badge if not already defined: