Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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
Hello @dhritimoy
For this task you need to add custom JAVASCRIPT code.
Hi @dhritimoy,
Please go to Actions > Edit code > Assets > theme.js file, find '_updatePrice:' and change code here:
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!
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025