cancel
Showing results for 
Search instead for 
Did you mean: 

Uncaught Error: Call to a member function getCheckoutFields()

Uncaught Error: Call to a member function getCheckoutFields()

I've facing an error while checkout, on the shipping methods part.

just add an item to cart, go for check out, confirm the checkout, on the shipping page the error will show up causing "Sorry, no quotes are available for this order at this time"

 

image

 

jquery.js:10254
POST ......./rest/default/V1/guest-carts/328dc46e3c1db2e17d22dc114f868c7f/estimate-shipping-methods 500 (Internal Server Error)

 

and the generated error in:

var/report/api

is:

Uncaught Error: Call to a member function getCheckoutFields() on array in vendor\/temando\/module-shipping-m2\/Observer\/SaveCheckoutFieldsObserver.php: 73

2 REPLIES 2

Re: Uncaught Error: Call to a member function getCheckoutFields()

Hello @khaledsawwaf

 

it is possible only if you are using some custom module for checkout and that override that js.

 

Try to disabled checkout related module and check it

 

Also you can disable temando shipping module if you are not using that.

 

Hope it will help you


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

Re: Uncaught Error: Call to a member function getCheckoutFields()

Most of the time this error is caused by some module that is running at checkout.
The problem is that it may not be that easy to identify.

Some steps that may help:
1 - View magento 2 logs while you use the frontend. Do not ssh run the command: tail -f var/log/exception.log var/log/system.log var/log/debug.log
2 - Has there been any type of update in your store? If so, the problem may be incompatibility. Check according to the magento version if all your modules are compatible.
3 - check your php version if you have updated magento (if you update php errors usually occur due to deprecated functions)
4 - It seems obvious, but test in developer mode:
bin/magento deploy:mode:show (see which mode you are in)
bin/magento deploy:mode:set developer (set developer mode)
bin/magento deploy:mode:set production(return to production when finished)
5 - In developer mode, clean all static files and caches, take the opportunity to update the Magento dependencies in the database, example:

rm -rf var/cache/* && rm -rf pub/static/adminhtml/* && rm -rf pub/static/frontend/* && rm -rf generated/* && php bin/magento cache:flush && php bin/magento cache:clear && php bin/magento setup:update


6 - Disable all your Magento modules. The idea is simple, test if everything is working in clean Magento (remember to activate a Magento default shipping mode and a Magento default payment mode to test the checkout).
To disable it you can do one via SSH:
bin/magento module:status (lists all modules and whether they are active or not)
bin/magento module:disable Vendor_NomeModulo (disables the module)
bin/magento module:enableVendor_NomeModulo (activates the module)
Or the easiest way for mass actions:
In the app/etc/ directory there is a copy of the config.php file. Open this file and mark "0" for all modules that you will deactivate (I suggest not deactivating any standard Magento module), save the file and run the command in item 5 above.
*If you use a custom template, I suggest activating luma within the Magento panel in content/design/configuration, so that Magento does not return exceptions as the theme will not find the modules or have a broken layout.
7 - If your server uses varnish, redis, clusters among others, make sure you have cleaned all of this and that you are selling and testing the correct version of magento
(tip is to activate Magento's default cache in developer mode in store/configuration/advanced/Full Page Cache/Caching Application -> Built-in Cache)
8 - once all this is done, just clean the browser and perform a new checkout test. The idea is simple, it's basically testing whether everything is working in the default Magento and activating the modules at a minimum to isolate the problem. By isolating the problem you can debug and address specific ways of troubleshooting.

If the error still persists, you need someone more advanced in Magento, to do more advanced debugging, for example xdebug, clean the vendor folder and run composer update, etc... maintaining Magento can be complex, hire a developer whenever you need to avoid bigger problems.

Hope this helps.