Last active
July 5, 2024 11:37
-
-
Save royvn/6ac359d91606a4af9f539fdcfa6074af to your computer and use it in GitHub Desktop.
Calculate product discount in percentage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- liquid | |
assign discount_percentage = product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | round | abs | |
echo discount_percentage | |
-%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment