cancel
Showing results for 
Search instead for 
Did you mean: 

Uncaught Error: Call to a member function getQuote() on null

Re: Uncaught Error: Call to a member function getQuote() on null

Hello @tvgarden

 

you need to create the on change event of that element and fire your js code.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Uncaught Error: Call to a member function getQuote() on null

This didn't work:

$( 'input[name="postcode"]' ).on( "change", function() {
console.log(getPostcode());

});

Re: Uncaught Error: Call to a member function getQuote() on null

Please don't instantiate the $objectManager directly. Magento has been recommending against this for a long time now. Also, as per Magento docs, rather than referencing your class name as a string, e.g. '\Magento\Checkout\Model\Cart', instead reference classnames like this \Magento\Checkout\Model\Cart::class

Re: Uncaught Error: Call to a member function getQuote() on null

You need to keep below js into your js file,

$( document ).on( "change",'input[name="postcode"]', function() {
	console.log(getPostcode());
});
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial