0

I upgrade my Magento store from 2.1.7 to 2.2.5 and I faced an issue on cart page.

When adding a product to cart and go to /checkout/cart/, In shipping summary section update the shipping country, postcode and state enter image description here

and click on Update Shopping Basket then address is not retained to and comes in default country enter image description here.

Can someone help me to get out of this?

  • Experiencing same in Magento version 2.3.1. Delivery Information does not persist when making actions to the cart e.g. update qty, remove item, add item. Currently unable to find potential solutions unless $this->cart->save() is removing the existing checkout postcode. – Adam Jun 24 at 11:29
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – Mohit Kumar Arora Jun 24 at 12:24
0

Experiencing same in Magento version 2.3.1. Delivery Information does not persist when making actions to the cart e.g. update qty, remove item, add item.

The postcode/region/country values can be found in the mage-cache-storage key within Local Storage which can be found in the Developer Toolbar. You can access the values needed through: mage-cache-storage.checkout-data.shippingAddressFromData object or through mage-cache-storage.cart-data.address object

Note that when you update the Cart the mage-cache-storage.checkout-data.shippingAddressFromData no longer exists hence the values clearing.

I have used the following snippet within the shipping-estimation.js of the Magento_Checkout module to check if the postcode can be found in the cart-data if it doesn't exist in the checkout-data and populate the fields that way.

$.initNamespaceStorage('mage-cache-storage').localStorage.get('cart-data.address.postcode')

There may be better methods of getting this storage but this is what I've settled for at the moment. Unfortunately time does not currently permit me to find the "perfect" solution.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.