On checkout page , this error comes up "default.js:70 Uncaught TypeError: Cannot read property 'method_code' of null" how to fix it? or get the value of 'method_code'?


Are you developing a custom shipping extension or just added a new one to Magento? This error is happening because the extension is not returning the correct data to the frontend.

You can fix that by disabling the faulty shipping extension. If you are developing a new one, try to debug it or share the code so we can help you.

| improve this answer | |
  • Can you tell me how to debug that js part of code efficiently ? – user88516 Apr 20 at 5:42
  • 1
    @developer Open your browser Developer Tools and go to the Network tab. Reload the page or change the zipcode to trigger the shipping rates again. A request to "estimate-shipping-methods" should appear on your Network tab (you can use the Filter to look for it). Find the request and click on it. Under "Preview" you should be able to see the response to this request as a JSON object and identify which one of them does not have the "method_code" and other problems with the data structure that may be causing this. – Andresa Martins Apr 20 at 6:27
  • Great ! Thanks, – user88516 Apr 20 at 7:28
  • you are awesome ! – user88516 Apr 20 at 7:28
  • Did you fix the issue? – Andresa Martins Apr 20 at 13:02

Your Answer

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