Shopify themes, liquid, logos, and UX
In my store price discount shows as you can see I want this will show with word SAVE like SAVE $20.00 how I ca do that my them is dawn in that price is not customize able .
Thanks
Hi @Alexa71 ,
We do need to add a custom code that will calculate the discount percentage and show it in place of compare price.
Thanks
Hi @Alexa71 ,
Follow these Steps:
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code just above tag </body>
<script>
setTimeout(function name(params) {
try {
let savingElement = document.querySelector('.sls-savings-badge span.money.conversion-bear-money');
let badgeElement = document.querySelector('span.badge.price__badge-sale');
if (savingElement && badgeElement) {
let saving = savingElement.innerHTML;
badgeElement.innerHTML = "Save " + saving;
} else {
console.log("One or both of the elements were not found.");
}
} catch (error) {
console.log("An error occurred:", error);
}
}, 3000);
</script>
Please don't hesitate to reach out if you need further help optimizing or customizing your store. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!
Best Regards,
LuffyOnePiece
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025