Start a conversation

Percent saved in product page

Hello,


If you are trying to find a percent saved in product page (display as "You save $xxx")

Unfortunately, BigCommerce doesn't support percent saved, so you need to customize a little to display percent saved in your site.


Edit file templates/components/products/price.html, find the below code block

Replace it with this code

           {{#if page_type '===' 'product'}}
             <div class="price-section price-section--saving price" {{#all (unless price.saved) (unless price.non_sale_price_with_tax) (unless price.non_sale_price_without_tax) }}style="display: none;"{{/all}}>
                {{#if price.saved}}
                    {{#if price.rrp_with_tax}}
                        {{#if (merge this discount=(round (multiply (divide price.saved.value price.rrp_with_tax.value) 100)))}}{{/if}}
                    {{else if price.rrp_without_tax}}
                        {{#if (merge this discount=(round (multiply (divide price.saved.value price.rrp_without_tax.value) 100)))}}{{/if}}
                    {{else if price.non_sale_price_with_tax}}
                        {{#if (merge this discount=(round (multiply (divide price.saved.value price.non_sale_price_with_tax.value) 100)))}}{{/if}}
                    {{else if price.non_sale_price_without_tax}}
                        {{#if (merge this discount=(round (multiply (divide price.saved.value price.non_sale_price_without_tax.value) 100)))}}{{/if}}
                    {{/if}}
                {{else if price.non_sale_price_with_tax}}
                    {{#if (merge this discount=(round (subtract 100 (multiply (divide price.with_tax.value price.non_sale_price_with_tax.value) 100))))}}{{/if}}
                {{else if price.non_sale_price_without_tax}}
                    {{#if (merge this discount=(round (subtract 100 (multiply (divide price.without_tax.value price.non_sale_price_without_tax.value) 100))))}}{{/if}}
                {{/if}}
                {{#if discount}}
                    <span class="price">{{lang 'products.you_save_opening_text'}}</span>
                    <span data-product-price-saved class="price price--saving">
                        {{discount}}%
                    </span>
                    <span class="price">{{lang 'products.you_save_closing_bracket'}}</span>
                {{/if}}
             </div>
        {{/if}}


Then Save & Publish.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Papathemes

  2. Posted
  3. Updated

Comments