{"id":1349,"date":"2020-11-15T15:39:32","date_gmt":"2020-11-15T15:39:32","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/11\/15\/show-custom-popup-on-click-of-proceed-to-checkout-button-from-minicart-in-magento-2\/"},"modified":"2025-07-17T15:26:11","modified_gmt":"2025-07-17T09:56:11","slug":"show-custom-popup-on-click-of-proceed-to-checkout-button-from-minicart-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/show-custom-popup-on-click-of-proceed-to-checkout-button-from-minicart-in-magento-2\/","title":{"rendered":"How to Show Custom Popup on click of &#8220;Proceed to Checkout&#8221; Button From Minicart in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The default&nbsp;Magento 2&nbsp;redirects a customer to the checkout page when the <a href=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2020\/11\/Default-Behaviour-.gif\" target=\"_blank\" rel=\"noreferrer noopener\">Proceed to Checkout<\/a> button is clicked as shown below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2020\/11\/Default-Behaviour--1024x532.gif\" alt=\"Default-Behaviour-.gif\" class=\"wp-image-11534\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">However, depending on the business requirements, one may want to show popup on the mini cart when \u201cProceed to checkout\u201d button is clicked in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The popup may show a custom sales message or further instructions or any offer related details on the mini cart that may be important for the business or customer to know at that stage of the purchase cycle.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, I have shared the programmatic solution to&nbsp;<em><strong>show custom popup on click of \u201cProceed to Checkout\u201d button from minicart in Magento 2<\/strong><strong>.<\/strong><\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Show Custom Popup on click of \u201cProceed to Checkout\u201d Button From Minicart in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create file&nbsp;<strong>requirejs-config.js<\/strong>&nbsp;under&nbsp;<strong><em><strong><em>app\\code\\Vendor\\Module\\view\\frontend<\/em><\/strong><\/em><\/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=\"\">var config = {\n    config: {\n        mixins: {\n            'Magento_Checkout\/js\/view\/minicart': {\n                'Vendor_Module\/js\/checkout\/view\/minicart': true\n            }\n        }\n    }\n};<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create file&nbsp;<strong>minicart.js<\/strong>&nbsp;under<strong><strong>&nbsp;<strong><strong>app\\code\\Vendor\\Module\\view\\frontend\\web\\js\\checkout\\view<\/strong><\/strong><\/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;pre class=\"lang:default decode:true\">define([\n    'jquery',\n    'Magento_Customer\/js\/customer-data'\n], function ($, customerData) {\n    'use strict';\n    return function (Component) {\n        return Component.extend({\n            \/**\n             * @override\n             *\/\n            getCartParam: function (name) {\n                var self = this;\n                if (name === 'possible_onepage_checkout') {\n                    $('#top-cart-btn-checkout').click(function (event) {\n                        var customer = customerData.get('customer');\n                        if (!customer().firstname) {\n                            event.preventDefault();\n                            $('.custom-popup').modal('openModal'); \/* Here you can put your message or call your popup *\/\n                            return false;\n                        }\n                    });\n                }\n                return this._super(name);\n            },\n        });\n    }\n});\n&lt;\/pre><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Run the below commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php bin\/magento setup:static-content:deploy -f\nphp bin\/magento cache:flush<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you implement the above solution, the frontend shows the custom popup as shown below:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2020\/11\/Custom-popup-1024x522.gif\" alt=\"Custom-popup.gif\" class=\"wp-image-11536\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Do consider sharing this post with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default&nbsp;Magento 2&nbsp;redirects a customer to the checkout page when the Proceed to Checkout button is clicked as shown below: However, depending on the business&#8230;<\/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-1349","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1349","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=1349"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions"}],"predecessor-version":[{"id":13938,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions\/13938"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}