NEW badge in product page

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 %}

pls if anyone can help me to add the same badge in the product page
this is my URL for site you can see the the ‘new’ badge in light blue color
https://flexmoreil.com/collections/%D7%99%D7%97%D7%A4%D7%A0%D7%99%D7%9D-%D7%91%D7%97%D7%95%D7%A8%D7%A3

Hi @Roeiam , thank you for posting here!

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:

  1. 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).
  2. 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 %}
  1. Style the Badge:
  • Go to Assets > base.css (or theme.css) and add styling for .badge if not already defined:
.badge {
  background-color: lightblue;
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  display: inline-block;
  margin-bottom: 10px;
}
  1. Test the Changes:
  • Save the changes and check a product page with the tag ‘חדש’ to confirm the badge appears correctly.

If my answer is working for you store, please let me know by Accepting Solution and Giving Like !!!

Hi @Roeiam ,

The code you use for the collection page can be re-edited to use on the product page as follows:

{% if product.tags contains 'חדש' %}
חדש
{% endif %}

You can add the code to the position you want.

Let me know if it works!

Best,

Daisy

hi thank fo the response
i try to add it but it dosent do anything
this is a part of the code:

{% render 'product-media-gallery', variant_images: variant_images %}
{%- assign product_form_id = 'product-form-' | append: section.id -%}

{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when ‘@app’ -%}
{% render block %}
{%- when ‘text’ -%}

{{- block.settings.text -}}

{%- when 'title' -%}

{{ product.title | escape }}

{{ product.title | escape }}

{%- when 'price' -%}
{%- render 'price', product: product, use_variant: true, show_badges: true, price_class: 'price--large' -%} {% if product.tags contains 'חדש' %} חדש {% endif %}

{%- assign product_name = product.title -%}
{%- assign price_in_shekels = product.price | divided_by: 100 -%}
{%- assign price_divided = price_in_shekels | divided_by: 3 | floor -%}

{%- unless product_name == “פלקסמור גרבי יחפנים - 5 אצבעות לכל פעילות” -%}

או עד 3 תשלומים שווים של ₪{{ price_divided }}

{%- endunless -%}

Hi @Roeiam ,

I see you have marked solution for this answer. May I ask if you still need help?