I am trying to hide the sale badge on the collection and product pages when the customer tag is “wholesale”. My theme is Dawn.
I have tried editing the code many different ways with no success. I have previously edited this section to change the format of the sale badge in snippets → card-product.liquid
I do still need the sold out badge to appear.
Any help would be appreciated, thank you!
Sydney
{% if customer %}
{% assign is_wholesale = false %}
{% for tag in customer.tags %}
{% if tag == 'wholesale' %}
{% assign is_wholesale = true %}
{% endif %}
{% endfor %}
{% endif %}
{% unless is_wholesale %}
// Highlighted code in screen-shot goes here.
{% endunless %}
If you need further help don’t hesitate to contact me.
You can find the email in the signature below.
Thanks
2 Likes
Hi @littleroots1
You can try to update that code to this version and check
{%- if card_product.available == false -%}
{{- 'products.product.sold_out' | t -}}
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
{% if customer %}
{% assign wholesale_tag = false %}
{% for tag in customer.tags %}
{% if tag == 'wholesale' %}
{% assign wholesale_tag = true %}
{% endif %}
{% endfor %}
{% if wholesale_tag %}
{{- 'products.product.on_sale' | t -}}
{%- endif -%}
{%- endif -%}
{%- endif -%}
Thank you, this worked for me! But only on the collection page, I am still seeing the badge on the product page.
For anyone needing to remove the badge from the product page as well, I just copied the above code into snippets/price.liquid and formatted it around line 36.