Shopify recently introduced some neat new Math Filters, making it possible to round numbers. I spent a lot of time figuring out how to show a percentage-based discount on the Cart Page and Product Page for a Shopify Client. I haven’t seen it posted anywhere else in its entirety; just in smaller pieces which are difficult to piece together. To save you the trouble, here’s what you’ll need:
CART PAGE
{{ item.variant.compare_at_price | money }}
{% endif %}
PRODUCT PAGE
Replace item.variant with product, like this:
{% if product.compare_at_price > item.variant.price %}
{% endif %}
—
***
Thank you again for keeping up with our Shopify Insider Blog @ Blackbelt Commerce. Please make sure to check out our products. We also have some top blog recommendations for you to check out; The Benefits Of Multichannel Thinking, how to increase shopify revenue, an overview to e-commerce regulations, the most excited e-commerce marketing trends, and The Best Shopify Cheat Sheet Resources. As always, keep a lookout for new blog posts.
Questions? Ask away in the comments below.