FROM CACHE - en_header

Discount display on product

LezzeriFran
New Member
1 0 0

Hello,

 

I would like to have my automatic discount show on my product pages, please can someone help? 

I have read the other threads and tried various codes, also watched a YouTube video and followed it to a 'T' but they have not worked.

 

I am on Dawn 5.0.0

 

Thank you in advance! 

 

 

Reply 1 (1)
GemPages
Shopify Partner
705 173 161

Hello @LezzeriFran 

 

This design from the theme

You can follow these steps:
1. Go to Online Store->Theme->Edit code

GemPages_0-1669350276068.png

2. Open your card-product.liquid file, paste code like this

GemPages_2-1669350384164.png

 {%  if card_product.compare_at_price > card_product.price and card_product.available -%}
   <div class="card__badge bottom right">
   <span class="badge badge--bottom-right {{ card_product.compare_at_price }}-{{ card_product.price }}" >
        <span class="gf_pq-discount gf_gs-text-paragraph-1">
          {% assign diff = card_product.compare_at_price | minus: card_product.price %}
          {% assign comparePriceFloat = card_product.compare_at_price | times: 1.0 %}
          {% assign diff = diff | divided_by: comparePriceFloat %}
          {% assign diff = diff | times: 100.0 %}
          {% assign diff = diff | round %}         
          <span class="gf_pq-percent">
            {{ diff }}%
          </span>
        
        </span>
      </span>
   </div>
    {%  endif %}

Result

GemPages_3-1669350448686.png

I hope the above is useful to you. 

 

Kind & Best regards,

GemPages Support Team

 

 

 

GemPages - Build any high-converting store pages for any business


- If you find my reply helpful, please hit Like and Mark as Solution
- Get connected: App Store | Blog | Community | Help Center