Magento – Magento 2 : problem in the Checkout page : window.checkoutConfig is undefined

checkouterrorjavascriptmagento2payment-methods

I am using Magento 2.0.2 and I have a problem with the Checkout page.

Sometimes there is a JS error appears in the file /Magento_Checkout/js/model/quote.min.js:

TypeError: window.checkoutConfig is undefined

In this case, the Checkout page is not displayed.

enter image description here

So could anyone please suggest me what are the steps that I follow to find out the solution?

Best Answer

I was also faced that problem. When my config file is

public function getConfig()
{
    $config = [
        'payment' => [
            'customPayment' => [
                'threed_secure' => $this->get3DSecure(),
            ]
        ]
    ];
    return $config;
}
public function get3DSecure()
{
    //Data from system.xml fields
    return $this->getConfigData('threed_secure');
}

Then i have created helper file and define that function here

public function get3DSecure(){
    return $this->_scopeConfig->getValue('payment/customPayment/threed_secure');
}

Called that function using helper When i have changed it to following code then it succeds

class Payfullapi extends \Magento\Framework\App\Helper\AbstractHelper
{
protected $method;
public function __construct(
    Payfullapi $helper
) {
    $this->helper = $helper;
}
/**
* {@inheritdoc}
*/
public function getConfig()
{
     $config = ['payment' => ['customPayment' => [
     'threed_secure' => $this->get3DSecure()
    return $config;
}
/**
* Get config from admin
*/
public function get3DSecure()
{
    //Data from system.xml fields
    return $this->helper->get3DSecure();
} 
}

If u want any help just comment here...! I will help u....!

Related Topic