I want to add a badge “XYZ” on products in collection page if they’re part of a specific collection. I would like the badge to appear similar to my SALE badge.
Please help me customise it without using a third party app.
I’m adding my current code here:
{% render 'wishlisthero-collection-product' with product: product %}
{% if featured_image.src== blank %}
{% else %}
{% include 'image-style' with image: featured_image, small_style: true, width: width, height: height, wrapper_id: img_wrapper_id, img_id_class: img_id_class %}
{% endif %}
{% if sold_out %}
SOLD OUT
{% elsif on_sale %}
SALE
{% endif %}
{{ product.title }}
{% if on_sale %}
{{ 'products.general.sale_price' | t }}
{% else %}
{{ 'products.general.regular_price' | t }}
{% endif %}
{% if product.price_varies %}
{% if product.compare_at_price_min == 0 %}
{{ product.price_min | money_without_trailing_zeros }} to {{ product.price_max | money_without_trailing_zeros }}
{% endif %}
{% if product.compare_at_price > product.price %}
From {{ product.compare_at_price_min | money_without_trailing_zeros }}{{ product.price_min | money_without_trailing_zeros }}
{% endif %}
{% elsif product.compare_at_price > product.price %}
{{ product.compare_at_price | money_without_trailing_zeros }} {{ product.price | money_without_trailing_zeros }}
{% else %}
{{ product.price | money_without_trailing_zeros }}
{% endif %}
{%- if product.price_varies == false and variant.unit_price_measurement -%}
{%- capture unit_price_separator -%}
/ {{ 'general.accessibility.unit_price_separator' | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endcapture -%}
{{ 'products.general.unit_price' | t }}
{{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
{%- endif -%}
{% if section.settings.product_vendor_enable %}
{{ product.vendor }}
{% endif %}