Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    Adding additional variables in window.checkoutConfig on Magento 2 Checkout page

    We often need to add more variables that we need to use on the checkout page at the time of checkout. Here is how we can do that.

    The first step is to add the following code in Vendor/Module/etc/frontend/di.xml of your custom module –


    After this, we will create AdditionalConfigVars.php in Vendor/Module/Model and add the following code to it –


    Now all you need to do is flush Magento cache and check  ‘window.checkoutConfig.test_var’ in your js on the checkout page. It will return ‘Test Var’.

    This is all for now.

    Suggestions and queries are welcome.

    . . .

    Comments (2)

    Add Your Comment

  • Sanne
    Thanks! Very helpful 🙂
    • Vinay Singh
      Hi Sanne,

      Thanks!

  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close