einicher.net

The Code must do the talking.

Magento2: Show grand_total in Minicart

3. August 2018

One of our customers needed the minicart to show the grand_total because of the huge quantity discounts they give. The Minicarts view file is Magento_Checkout/templates/cart/minicart.phtml. For the grand_total to work with Javascript you need to add it as data-bind attribute with getCartParam – there is only one problem: grand_total ist not part of the data the Minicart collects. To get it in there you need to overwrite the getSectionData method of \Magento\Checkout\CustomerData\Cart. Here are the two files — if you have questions, just ask them in the comments – I do not explain further cause i hate to read long explanations myself – the code must do the talking.

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *