How to Show Subtotal Besides Cart Icon in Magento 2
Shoppers tend to get distracted from the budget once the shopping starts! This is no different when it comes to online shopping too!
Therefore, the online store owners can facilitate shoppers with a feature that lets them keep an eye on the total amount spent while shopping continues.
In Magento 2, the customers have to click on the mini cart to see the subtotal amount after adding multiple products to the cart.
Due to this, the customers may go over-budget unknowingly as the subtotal is not visible on the website.
That’s why it is better to show subtotal besides cart icon in Magento 2 storefront.
I have prepared a programmatic solution that will help you to display subtotal besides the cart icon in the Magento 2 store.
The frontend will look something like this:
Method to Show Subtotal after Cart Icon in Magento 2:
For programmatic solution, open a file from this path,
app/design/frontend/[Namespace]/[theme]/Magento_Checkout/templates/cart/minicart.phtml
Add this code:
<span class=“price-label” data-bind=“html: getCartParam(‘subtotal’)”></span>
That’s it!
If you have any doubts regarding this solution, feel free to ask in the Comments section below.
I would be happy to help you. You may also love to read our another blog post on How to Configure Checkout Totals Sort Order in Magento 2.
Don’t forget to share this post with the Magento community via social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
Prev
Magento 1 – PHP Fatal error: getAllOptions() on PHP 7.2
How to Override Extension File in Theme in Magento 2
Next