How to add best sellers badge - Dawn theme

Hello !

I’m trying to add a best seller badge on the best sellers products.

I have a code that is working but the badge appears on the top of the image and not on the image and, because of that, my images are not aligned.

I tried to change the relative position by an absolute one but when it’s in absolute, the badge disappear.

Can someone help me please ?

main-collection-product-grid.liquid

{% for tag in product.tags %}
                {% if tag contains "best" %}
                Best seller 
                {% endif %}
                {% endfor %}
      
1 Like

Hello @yoursparis

Its Artzen Technologies! We will be happy to help you today.

I understood your problem and i have come up with a solution that will help you in achieving the desirable result.

Please Change yours code with the below code .

{% for tag in product.tags %}
    {% if tag contains "best" %}
        
            
            Best seller
        

    {% endif %}
{% endfor %}

Let me know if need further assistance
Regards,
Artzen Technologies

1 Like

Hello @yoursparis

Add this code and check it.

{% for tag in product.tags %}
  {% if tag contains "best" %}
    
      Best Seller
    

  {% endif %}
{% endfor %}

1 Like

Hi Artzen, thanks for your answer :slightly_smiling_face:

Unfortunatly this is not working. The badge appear like in the photo below

Hi Zestard ! Thanks for your help :slightly_smiling_face:

Unfortunatly it dosn’t work. The badge appear on the left side (on the next product) and the photo are still not aligned.

Do you have any idea for me please ?

I changed a bit your code and it’s now working perfectly :slightly_smiling_face: I just remove the display: inline-block in product-badge.

Thanks for your help :slightly_smiling_face:

{% for tag in product.tags %}
  {% if tag contains "best" %}
    
      Best Seller
    

  {% endif %}
{% endfor %}

1 Like

Hello there,

Where to add exactly please share me screenshot and site url so i will check it

Thank you for your response. It’s good to know that it’s worked for you. Kindly feel free to get back to me if you need any further assistance.
If helpful then please Like and Accept Solution.

1 Like