Skip to content

totalsData not updating correctly in checkout - shipping cost not being included #6796

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

Closed
delgadito13 opened this issue Sep 28, 2016 · 4 comments

Comments

@delgadito13
Copy link

We are working on a project for a client and are using for them Magento 2.1 in Magento Cloud.
The issue we have detected is regarding the totalsData object. As it seem it does not include the shipping cost of the chosen shipping method.
steps to reproduce:

  • go to home page
  • browse to product or search for products
  • add product(s) to the cart/bag
  • goto cart/bag
  • review the bag
  • checkout
  • enter email address and customer details
  • select payment method with cost (not free shipping)
  • select payment method

When looking at the totalsData information, it does not include the shipping cost.
window.checkoutConfig.totalsData.grand_total

See attachment.

When reloading the page though this information gets updated and the shipping cost is being included.
Though reloading the page at this stage has some side effects, like losing the billing address details.

The information of the totalsData is being used for payment calls and creates an issue as the total of the orders, in the totalsData does not match the actual total for which a payment authorization is being requested.

This information might also be used for tracking or analytics.

Details.pptx

Preconditions

Magento 2.1 cloud edition.

Steps to reproduce

See above

Expected result

What we need to see is that the totalsData gets update with the total amount, including shipping cost prior to doing a payments call.

Actual result

We see that the shipping cost is not included in the totalsData, after choosing the shipping method and selecting the payment option.

@SerhiyShkolyarenko
Copy link
Contributor

SerhiyShkolyarenko commented Sep 29, 2016

@delgadito13 window.checkoutConfig.totalsData is dataset for initializing JS components. Its data is actual on page loading moment only. If you reload page you'll see actual info there.
Dynamically updated totals are stored in totals property of code/Magento/Checkout/view/frontend/web/js/model/quote.js component. To work with it please use getTotals() and setTotals() methods.
Usage examples in code/Magento/Checkout/view/frontend/web/js/view/summary/grand-total.js. Please, pay attention to double pair of brackets: quote.getTotals()(). If you leave only one pair of brackets[quote.getTotals()], you'll receive an observable object, but not the value.

@SerhiyShkolyarenko
Copy link
Contributor

Closing as far as no questions for several days.

@maximehuran
Copy link
Member

Still have this problem

@sergiomendonca
Copy link

sergiomendonca commented Apr 26, 2019

Old bug, 3 years later and continues the same bug. It is one bug of checkoutConfig, has many and many bugs... Try to give a discount and you see all collapse.
We cant make payment using checkoutConfig js, its terrible. We have to leave the checkout page to make a payment using only php. So, if the credit card does not work you have to make all the payment again....We have to trust customer patience.

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

No branches or pull requests

4 participants