Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'method_code' of null #79

Open
pauldonnelly opened this issue Jan 16, 2019 · 2 comments
Open

Cannot read property 'method_code' of null #79

pauldonnelly opened this issue Jan 16, 2019 · 2 comments

Comments

@pauldonnelly
Copy link

Hi, We're getting an error when we switch between countries at the Shipping section of the checkout.
An example would be switching from United Kingdom to any other country and back again.
The first time it works fine but switching back we get this console error.
Because of this error the loader does not disappear and we cannot use the rest of the checkout.

Console Error:

select-shipping-method-mixin.js:45 Uncaught TypeError: Cannot read property 'method_code' of null
at select-shipping-method-mixin.js:45
at Object.resolveShippingRates (checkout-data-resolver.js:173)
at Object.setShippingRates (shipping-service.js:25)
at Object. (new-address.js:59)
at fire (jquery.js:3232)
at Object.fireWith [as resolveWith] (jquery.js:3362)
at done (jquery.js:9840)
at XMLHttpRequest.callback (jquery.js:10311)

@pauldonnelly
Copy link
Author

I think i've fixed it but can you confirm is this is correct?

Within:

vendor/rubic/magento2-module-clean-checkout/src/view/frontend/web/js/mixin/select-shipping-method-mixin.js

Before:

var payload = {...}

Add:

if (shippingMethod === null) {
return;
}

@razza12
Copy link

razza12 commented Jul 10, 2019

This also fixed it for me, thanks @pauldonnelly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants