Thank you so much for the fast respond. I tried what you suggest and it doesn’t work for me. I am using debut theme, for some reason can you tell where should I put it?
Well, that depends on which version of Debut you have, I’m not familiar with all versions however assuming you want this data to show next to the pricing you should see something like this in product-template.liquid.
<div class="product__price">
{% include 'product-price', variant: current_variant %}
</div>
If that’s the case then you wanna go into product-price.liquid
I have tried what you instruct and follow it carefully. I believe we have the same debut version because all the codes that you show are very similar to mine.
The problem is when I selected a new variant the percentage discount disappear.
ok I’m back now, sorry bout the wait, aight so the issue is that your data-sale-price is controlled by a function within theme.js which changes the value based on the variant selected, Shopify’s liquid isn’t as good as Angular or React yet, basically, you can’t double bind elements in order to refresh the data once it’s loaded which is why liquid… is far behind and sucks but that’s life, so Javascript to the rescue.
Doing a quick search through theme.js we can trace where the data is being changed and there we go, let’s change the code a bit to have it render what we want. However before let’s change the liquid a bit to this
It could be refactored a bit with more elegant code but ES6 isn’t compatible with most older browsers which represent 5-15% of your sales, unless you installed a polyfill library like babel.js