All things Shopify and commerce
Hello all,
I wan to add regular price, sale price and how much customers saved for the product to cart items in Shopify cart Page. How can I add it in Shopify to my cart page. I use dawn theme
Solved! Go to the solution
This is an accepted solution.
Hi @Nijat123
To accomplish the above requirements, you need to change the liquid file of the store. You can follow the steps below:
- Go to Online Store > Theme > Edit code
- Then search for "cart" in the search box => find the file main_cart_items.liquid => find line 87:
- Make changes to the code: Find the code in the main_cart_items.liquid file found above.
- And replace them with the code below:
{%- if item.original_price != item.final_price -%}
<div>
<div>
<span>
{{ 'products.product.price.regular_price' | t }}
</span>
<s class="cart-item__old-price product-option">
{{- item.original_price | money -}}
</s>
</div>
<div>
<span>
{{ 'products.product.price.sale_price' | t }}
</span>
<strong class="cart-item__final-price product-option">
{{ item.final_price | money }}
</strong>
</div>
<div>
Price saved {{ item.original_price | minus: item.final_price | money}}
</div>
</div>
{%- else -%}
<div>
{% if item.product.compare_at_price %}
<div>
Regular price <s class="cart-item__old-price product-option">
{{item.product.compare_at_price | money }}
</s>
</div>
{% endif %}
Sale price
<strong class="cart-item__final-price product-option">
{{ item.original_price | money }}
</strong>
{% if item.product.compare_at_price %}
<div>
Price saved
{{ item.product.compare_at_price | minus: item.original_price | money}}
</div>
{% endif %}
</div>
{%- endif -%}
Save your code and check the result. Here are the result that we have done:
I hope that it will work for you.
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS
BSS Commerce - Shopify Apps & Store Development Service Provider
Hire a Shopify expert | Shopify Plus Store Development
This is an accepted solution.
Hi @Nijat123
To accomplish the above requirements, you need to change the liquid file of the store. You can follow the steps below:
- Go to Online Store > Theme > Edit code
- Then search for "cart" in the search box => find the file main_cart_items.liquid => find line 87:
- Make changes to the code: Find the code in the main_cart_items.liquid file found above.
- And replace them with the code below:
{%- if item.original_price != item.final_price -%}
<div>
<div>
<span>
{{ 'products.product.price.regular_price' | t }}
</span>
<s class="cart-item__old-price product-option">
{{- item.original_price | money -}}
</s>
</div>
<div>
<span>
{{ 'products.product.price.sale_price' | t }}
</span>
<strong class="cart-item__final-price product-option">
{{ item.final_price | money }}
</strong>
</div>
<div>
Price saved {{ item.original_price | minus: item.final_price | money}}
</div>
</div>
{%- else -%}
<div>
{% if item.product.compare_at_price %}
<div>
Regular price <s class="cart-item__old-price product-option">
{{item.product.compare_at_price | money }}
</s>
</div>
{% endif %}
Sale price
<strong class="cart-item__final-price product-option">
{{ item.original_price | money }}
</strong>
{% if item.product.compare_at_price %}
<div>
Price saved
{{ item.product.compare_at_price | minus: item.original_price | money}}
</div>
{% endif %}
</div>
{%- endif -%}
Save your code and check the result. Here are the result that we have done:
I hope that it will work for you.
If our suggestions are useful, please let us know by giving it a like or marking it as a solution.
For B2B solutions and custom pricing, check out B2B Solution & Custom Pricing |
For adding product labels/badges, visit Product Labels by BSS
BSS Commerce - Shopify Apps & Store Development Service Provider
Hire a Shopify expert | Shopify Plus Store Development
Thank you for your reply, it worked. great
Worked perfect for me too, thanks so much!
User | RANK |
---|---|
51 | |
47 | |
39 | |
28 | |
21 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023