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, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
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, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
Thank you for your reply, it worked. great
Worked perfect for me too, thanks so much!
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024