0

I am working with magento2, and now I want open popup modal box when the user clicks on checkout link. Instead of the open checkout page, it should open my custom pop box with the module in magento2. Anyone know about this please give me a suggestion.

  • Can you please give me one example or what exactly we need to work with my custom module. Because I did not have more knowledge about custom module and how to override checkout javascript with my current module please give me suggestions – Web developer Jun 27 at 16:37
0

Please try with below event, which is working with before checkout page.

controller_action_predispatch_checkout_index_index
0

Observers are used, when you want to do something with the data of cart , but for your requirement you need work with js , html and phtml.

For example if you want to open a popup on click of minicart on the sidebar Proceed To checkout button then override

/vendor/magento/module-checkout/view/frontend/web/js/sidebar.js

and then change this events['click ' + this.options.button.checkout] as per your requirement

If you want to check the same in checkout page then override

/vendor/magento/module-checkout/view/frontend/templates/onepage/link.phtml

and remove

data-mage-init='{
    "Magento_Checkout/js/proceed-to-checkout":{
        "checkoutUrl":"<?= /* @escapeNotVerified */ $block->getCheckoutUrl() ?>"
    }
}'

then add your popup on click or you can add your data-mage-init

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.