{"id":1965,"date":"2021-11-26T11:07:59","date_gmt":"2021-11-26T11:07:59","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/show-additional-data-in-magento-2-mini-cart\/"},"modified":"2025-07-16T17:02:00","modified_gmt":"2025-07-16T11:32:00","slug":"show-additional-data-in-magento-2-mini-cart","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/show-additional-data-in-magento-2-mini-cart\/","title":{"rendered":"How to Show Additional Data in Magento 2 Mini Cart"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The mini cart in\u00a0Magento 2\u00a0store shows the gist of items in the cart. It is enabled by default and appears when you click the cart icon at the top of the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The default Magento 2 mini cart is something like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/11\/Default-Magento-2-mini-cart.png\" alt=\"Default Magento 2 mini cart\" class=\"wp-image-17077\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">When you want to display the correct product title after converting the html equivalent to the characters but the actual result differs is where you need to have the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/solved-display-product-title-with-special-characters-in-magento-2-mini-cart\/\">solution to display product titles with special characters in Magento 2<\/a>. However, based on the modern business requirements, if you want to show additional data in Magento 2 mini cart, follow the solution given in this post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You may add a button, or display VAT amount, coupon code, discount availed, etc. that is not included in the default mini cart.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Show Additional Data in Magento 2 Mini Cart:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>di.xml<\/strong><\/em>&nbsp;under&nbsp;<strong><strong>Vendor\\Module\\etc\\frontend<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:ObjectManager\/etc\/config.xsd\">\n    &lt;type name=\"Magento\\Checkout\\CustomerData\\Cart\">\n        &lt;plugin name=\"minicart_content\" type=\"Vendor\\Module\\Plugin\\Checkout\\CustomerData\\Cart\"\/>\n    &lt;\/type>\n&lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>cart.php<\/strong><\/em>&nbsp;under&nbsp;<strong><strong>Vendor\\Module\\Plugin\\Checkout\\CustomerData<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nnamespace Vendor\\Module\\Plugin\\Checkout\\CustomerData;\n\nclass Cart {\n    public function afterGetSectionData(\\Magento\\Checkout\\CustomerData\\Cart $subject, array $result)\n    {\n        $result['content'] = 'test'; \/\/ Add extra content here\n        return $result;\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>checkout_cart_sidebar_total_renderers.xml<\/strong><\/em>&nbsp;under&nbsp;<strong><strong>Vendor\\Module\\view\\frontend\\layout<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n      xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n        &lt;referenceBlock name=\"minicart\">\n            &lt;arguments>\n                &lt;argument name=\"jsLayout\" xsi:type=\"array\">\n                    &lt;item name=\"components\" xsi:type=\"array\">\n                        &lt;item name=\"minicart_content\" xsi:type=\"array\">\n                            &lt;item name=\"children\" xsi:type=\"array\">\n                                &lt;item name=\"subtotal.container\" xsi:type=\"array\">\n                                    &lt;item name=\"children\" xsi:type=\"array\">\n                                        &lt;item name=\"extra\" xsi:type=\"array\">\n                                            &lt;item name=\"component\" xsi:type=\"string\">uiComponent&lt;\/item>\n                                            &lt;item name=\"config\" xsi:type=\"array\">\n                                                &lt;item name=\"template\" xsi:type=\"string\">Vendor_Module\/checkout\/minicart\/content&lt;\/item>\n                                            &lt;\/item>\n                                            &lt;item name=\"children\" xsi:type=\"array\"> \n                                                &lt;item name=\"subtotal.totals\" xsi:type=\"array\">\n                                                    &lt;item name=\"component\" xsi:type=\"string\">Magento_Checkout\/js\/view\/checkout\/minicart\/subtotal\/totals&lt;\/item>\n                                                    &lt;item name=\"config\" xsi:type=\"array\">\n                                                        &lt;item name=\"template\" xsi:type=\"string\">Vendor_Module\/checkout\/minicart\/content\/data&lt;\/item>\n                                                    &lt;\/item>\n                                                &lt;\/item>\n                                            &lt;\/item>\n                                        &lt;\/item>\n                                    &lt;\/item>\n                                &lt;\/item>\n                            &lt;\/item>\n                        &lt;\/item>\n                    &lt;\/item>\n                &lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/referenceBlock>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>content.html<\/strong><\/em>&nbsp;under&nbsp;<strong><strong>Vendor\\Module\\view\\frontend\\web\\template\\checkout\\minicart<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;div class=\"content\">\n    &lt;span class=\"label\">\n        &lt;!-- ko i18n: 'Extra Content' -->&lt;!-- \/ko -->\n    &lt;\/span>\n    &lt;!-- ko foreach: elems -->\n    &lt;!-- ko template: getTemplate() -->&lt;!-- \/ko -->\n    &lt;!-- \/ko -->\n&lt;\/div><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong>data.html<\/strong><\/em>&nbsp;under&nbsp;<strong>Vendor\/Module\/view\/frontend\/web\/template\/checkout\/minicart\/content<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;div>\n     &lt;span class=\"label\">\n        &lt;!-- ko i18n: 'Extra content is ' -->&lt;!-- \/ko -->\n    &lt;\/span>\n    &lt;span class=\"custom-wrapper\" data-bind=\"html: cart().content_data\">&lt;\/span>\n&lt;\/div><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just like showing additional data in mini cart you can also&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/restrict-quantity-update-from-mini-cart-in-magento-2\/\">restrict quantity update from minicart in Magento 2<\/a>&nbsp;this will be helpful when you have set condition of limiting the order quantity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do share the post with the Magento Community via social media. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn the programmatic method to show additional data in Magento 2 mini cart for better customer experience at checkout.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1965","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1965"}],"version-history":[{"count":5,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1965\/revisions"}],"predecessor-version":[{"id":18008,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1965\/revisions\/18008"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}