The comparison of the discount price and before price is only displayed on the product site, but when checking out the only price showing is the new price, i would like the comparison at checkout as well.
please help me
The comparison of the discount price and before price is only displayed on the product site, but when checking out the only price showing is the new price, i would like the comparison at checkout as well.
please help me
Hello @sofiaaks ,
Welcome to Shopify Community!
There are a few different ways you can display the original price and the discounted price on the checkout page.
One approach is to add a section to your checkout template that displays the original price and the discounted price next to each other. You can then use Liquid to compare the two prices and calculate the discount amount. Here’s an example of how you might accomplish this:
~~{{ line_item.original_price | money }}~~
{{ line_item.price | money }}
{{ line_item.original_price - line_item.price | money }}
In the above example, line_item is the individual product in the cart. line_item.original_price is the original price of the product, and line_item.price is the price after the discount has been applied. The money filter formats the numbers as currency, and tag is used to show the original price with a strike-through.
Another way of displaying the discounted price is to create a custom script which calculate the difference between the original price and the discounted price, and then it add that value as a discount property on the line item object and then use it to display it.
You would need to implement this in your checkout.liquid and/or your cart.liquid template, or in any other liquid template that you use on your checkout page.
Please let me know if you need further assistance.