Why does the discount percentage not update with size selection?

Why does the discount percentage not update with size selection?

dhritimoy
Shopify Partner
9 0 1

Hi,

 

In my product page If click on Size button like "pack1, pack2 or pack3 " price are changing but % of discount not changing. If I will refresh taht time % of discount changing only. Below product few producr page links.

https://www.natures-nectar.com/products/natural-honey-1kg-1

https://www.natures-nectar.com/products/raw-acacia-honey-400g?_pos=2&_sid=c5e6fe263&_ss=r

https://www.natures-nectar.com/products/raw-jamun-honey-400g?_pos=1&_sid=08bca211a&_ss=r

https://www.natures-nectar.com/products/pure-honey-squeezy-pack-500g?_pos=1&_sid=5bad8b167&_ss=r

Replies 2 (2)

MandasaTech
Shopify Partner
723 146 151

Hello @dhritimoy 
For this task you need to add custom JAVASCRIPT code.

☞ Helpful or Question answered? Please Click Like & Mark it Accepted Solution
☞ Want to modify or custom changes on store for affordable price? Click on Contact button here
☞ Email at info@mandasa.in
☞ Whatsapp at +918989609120 | Hire us at: Website Support Page

LitCommerce
Astronaut
2860 684 760

Hi @dhritimoy,

Please go to Actions > Edit code > Assets > theme.js file, find '_updatePrice:' and change code here:

Screenshot.png

Code:

var saveamt = this.priceContainer.querySelector('.saveamt');
var relprc = this.priceContainer.querySelector('.relprc');
this.productState.onSale ? (c.forEach(function(n) {
    a(n, i.compare_at_price)
}), s.innerHTML = theme.Currency.formatMoney(i.price, theme.moneyFormat), saveamt.innerHTML = theme.Currency.formatMoney((i.price - i.compare_at_price), theme.moneyFormat), relprc.innerHTML = '('+Math.round(100 - (i.compare_at_price/i.price)*100)+'%)') : (c.forEach(function(n) {
    a(n, i.price)
}), saveamt.innerHTML = '', relprc.innerHTML = ''), this.productState.showUnitPrice && (r.innerHTML = theme.Currency.formatMoney(i.unit_price, theme.moneyFormat))

Hope it helps!

LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool.
Effortlessly sell on biggest marketplaces like Amazon, Etsy, eBay, Facebook etc with bulk listing tool, real-time sync & smart order management. Use LitCommerce free for 1-year now!