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

Add missing return in resolveShippingRates #6321

Merged
merged 4 commits into from
Mar 21, 2017
Merged

Add missing return in resolveShippingRates #6321

merged 4 commits into from
Mar 21, 2017

Conversation

GordonLesti
Copy link
Contributor

@GordonLesti GordonLesti commented Aug 24, 2016

In the function resolveShippingRates is a missing return statement after selectShippingMethodAction. Without this statement it can happen, that selectShippingMethodAction is called second time.
This leads to the point that selectShippingMethodAction is called with the parameter true and that for example shipping.js returns undefined - undefined as carrier title and method title of the shipping method.

This behavior can be reproduced with

  • more than one available shipping method so that ratesData.length is bigger than 1
  • select a shipping method in the checkout so that window.checkoutConfig.selectedShippingMethod exists
  • go back to cart
  • the shipping method in cart-totals will be rendered twice and the second time with Shipping (undefined - undefined)

Edit

Since commit e72482c9fd7eeaac29f9710b6c39c9eafe5ed0b0 the code

if (!availableRate && window.checkoutConfig.selectedShippingMethod) {
    availableRate = true;
    selectShippingMethodAction(window.checkoutConfig.selectedShippingMethod);
}

has changed to

if (!availableRate && window.checkoutConfig.selectedShippingMethod) {
    availableRate = window.checkoutConfig.selectedShippingMethod;
    selectShippingMethodAction(window.checkoutConfig.selectedShippingMethod);
}

and the undefined - undefined problem doesn't occur anymore, but without the return statement the function selectShippingMethodAction is called twice with the same argument and the shipping method is rendered twice without any reason.

@vrann
Copy link
Contributor

vrann commented Mar 20, 2017

@GordonLesti please update the code with the latest mainline

@vrann vrann self-assigned this Mar 20, 2017
…ates

Conflicts:
	app/code/Magento/Checkout/view/frontend/web/js/model/checkout-data-resolver.js
@GordonLesti
Copy link
Contributor Author

@vrann code is updated with latest mainline.

@vrann
Copy link
Contributor

vrann commented Mar 21, 2017

@GordonLesti successfully merged, thank you!

@GordonLesti
Copy link
Contributor Author

@vrann thank you

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

Successfully merging this pull request may close these issues.

4 participants