Hide the sale badge when customer tag meets condition - Dawn theme

Solved

Hide the sale badge when customer tag meets condition - Dawn theme

littleroots1
Tourist
4 1 0

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 

 

Screen Shot 2024-07-15 at 9.14.07 PM.png

I do still need the sold out badge to appear.

 

Any help would be appreciated, thank you!

Sydney

Accepted Solutions (2)

Guleria
Shopify Partner
4112 804 1155

This is an accepted solution.

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

wholesale.png

 

If you need further help don't hesitate to contact me. 
You can find the email in the signature below.

Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

View solution in original post

littleroots1
Tourist
4 1 0

This is an accepted solution.

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.

Screen Shot 2024-07-30 at 3.34.36 PM.png

View solution in original post

Replies 4 (4)

Guleria
Shopify Partner
4112 804 1155

This is an accepted solution.

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

wholesale.png

 

If you need further help don't hesitate to contact me. 
You can find the email in the signature below.

Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
littleroots1
Tourist
4 1 0

Thank you, this worked for me!  But only on the collection page, I am still seeing the badge on the product page.

littleroots1
Tourist
4 1 0

This is an accepted solution.

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.

Screen Shot 2024-07-30 at 3.34.36 PM.png

Dan-From-Ryviu
Shopify Partner
11624 2277 2458

Hi @littleroots1 

You can try to update that code to this version and check 

 

            {%- if card_product.available == false -%}              
                <span
                  id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}"
                  class="badge badge--bottom-left color-{{ settings.sold_out_badge_color_scheme }}"
                >
                  {{- 'products.product.sold_out' | t -}}
                </span>               
            {%- 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 %}
                  <span
                    id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}"
                    class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}"
                  >
                    {{- 'products.product.on_sale' | t -}}
                  </span>
                {%- endif -%}   
              {%- endif -%}   
            {%- endif -%}  

 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.