Change "sales" text to percentage on Simple Theme

Solved
New Member
3 0 0

I've been trying to make few changes in the Simple Theme but was stuck at this part. I need to change sale circle to percentage and was not able to figure out that. Can anyone help me out with this?

0 Likes
Highlighted

Hello @Kennyyuh,

If you want to change sale for product page then follow below steps

1. Go to Online Store->Theme->Edit code
2. Sections->product-template.liquid:-> open the file

Search the code

{% if product.compare_at_price_max > product.price %}
            <span class="badge badge--sale"><span>{{ 'products.product.on_sale' | t }}</span></span>
          {% endif %}

Replace the above code with below code

 

{% if product.compare_at_price_max > product.price %}
<span class="badge badge--sale"><span>{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%</span></span>
{% endif %}
Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
1 Like
Highlighted
New Member
3 0 0

Thank you! Although, it still shows the "sale" text on the home screen, do you have a solution for that?


@oscprofessional wrote:

Hello @Kennyyuh,

If you want to change sale for product page then follow below steps

1. Go to Online Store->Theme->Edit code
2. Sections->product-template.liquid:-> open the file

Search the code

{% if product.compare_at_price_max > product.price %}
            <span class="badge badge--sale"><span>{{ 'products.product.on_sale' | t }}</span></span>
          {% endif %}

Replace the above code with below code

 

{% if product.compare_at_price_max > product.price %}
<span class="badge badge--sale"><span>{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%</span></span>
{% endif %}

 

0 Likes
Highlighted

Success.

@Kennyyuh,

For homepage

1. Go to Online Store->Theme->Edit code

2.Snippets->product-grid-item.liquid

Search below code

{% if on_sale %}
      <span class="badge badge--sale"><span>{{ 'products.product.on_sale' | t }}</span></span>
    {% endif %}

Replace with

{% if on_sale %}
     {% if product.compare_at_price_max > product.price %}
      <span class="badge badge--sale"><span>{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%</span></span>
      {% endif %}
    {% endif %}

 

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
1 Like