magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Ship To address on Checkout's Review step gets cleared out. User gets stuck on Payment step #6869

Closed PascalBrouwers closed 7 years ago

PascalBrouwers commented 7 years ago

Preconditions

  1. Magento 2.1.1 (latest develop branch)

    Steps to reproduce

  2. Related to MAGETWO-58062. Must be logged in as customer. Customer has 1 address that is the same for billing and shipping.
  3. Add product to your cart, but make sure you visit cart page first (checkout/cart).
  4. Press 'Proceed to Checkout'.
  5. On the checkout page the only address get's selected first, but after a short amount of time it get's unselected again (because of a trigger from self.validateFields() in Magento_Checkout/view/frontend/web/js/model/shipping-rates-validator.js) This is because local storage checkout-data.shippingAddressFromData has been set and should not because this is filling in the new-shipping-address form and the value change triggers the self.validateFields() which in the end makes that quote.shippingAddress() is a new address in initObservable() of Magento_Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js

    Expected result

  1. The 1 shipping address should be selected.

    Actual result

  1. Shipping address get's unselected.
  2. When going to step 2 of the checkout you get stuck because of this. See this video for explanation: http://cloud.h-o.nl/hfR2
PascalBrouwers commented 7 years ago

I added a fix. See my Pull Request.

PascalBrouwers commented 7 years ago

@veloraven can you assign this one to somebody? Not being able to checkout seems like a serious issue.

SerhiyShkolyarenko commented 7 years ago

Thank you for reporting! Our internal issue is MAGETWO-59362.

PascalBrouwers commented 7 years ago

@SerhiyShkolyarenko Can you run the CI on my pull request again?

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers I'm not autorized to rerun builds. I rechecked the issue on the latest develop branch and didn't reproduce it. Is it still reproducible for you on pure mainline/develop?

PascalBrouwers commented 7 years ago

You seem to have fixed it on the review step so the customer doesn't get stuck, but the problem is still there in the first step. I made a video so you can see the problem better: http://cloud.h-o.nl/hiPS

Also note the whole problem with adding a new address. It should be empty but because of this bug it loads old data from your local storage of the browser:

screen shot 2016-10-10 at 11 53 41
PascalBrouwers commented 7 years ago

Ps. I ran this with the latest develop branch at changeset: d8eac0001e95dc12247290ce75a3b6a9fe6b4725

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers could you please run "window.localStorage.clear()" in browser console, clear all cookies for the site and clear all browser cache, remove all files by mask pub/static/*, press Ctrl-F5, then rerun you steps? Do you have the same result?

PascalBrouwers commented 7 years ago

@SerhiyShkolyarenko I did all that. Problem is still there. The fix is quite simple, if you look at my PR.

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers prefilled form is not reproducible for me too.

PascalBrouwers commented 7 years ago

@SerhiyShkolyarenko how are you trying to reproduce it? Maybe it'll help if you use a db dump from me?

SerhiyShkolyarenko commented 7 years ago

Let's go through all steps:

  1. git pull
  2. sudo rm -rf var/*
  3. sudo bin/magento setup:uninstall
  4. sudo rm -rf var/* pub/static/*
  5. sudo chmod -R 777 app/etc
  6. Web installation
  7. On backend created product "banana" with price $5 in category "fruits"
  8. sudo bin/magento indexer:reindex and sudo chmod -R 777 var/*
  9. On frontend home page i removed all cookies, cache, and cleared localStorage. Reloaded with Ctrl-F5.
  10. Registered a customer on frontend.
  11. Added default address.
  12. On frontend added banana to shopping cart.
  13. Went to cart page.
  14. Proceeded to checkout.
  15. After several seconds clicked "+ New Address" Actual result on the screenshot. new_address_checkout_form
SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers I think DB dump will be helpful, if you have another result for these steps.

PascalBrouwers commented 7 years ago

Here is the dump. I hope you can reproduce it with this. magento2github.sql.gz

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers I applied your DB, repeated steps 10-15 from my previous post and everything worked properly: shipping address stayed selected and new address form was empty except the name fields and country.

PascalBrouwers commented 7 years ago

I'll try following your steps again. If I get no problem at that point there is still an issue with users who have 'old cache' then.

PieterCappelle commented 7 years ago

We have exact the same problem as @PascalBrouwers described. We're on version 2.1.2.

SerhiyShkolyarenko commented 7 years ago

@PieterCappelle can you describe detailed steps from the clean installation? Is it reproducible for develop branch too?

peec commented 7 years ago

I can reproduce. 2.1.2 . Production, one of our customers have the same problem. We lost a sale on this just now. This is urgent! When shipping methods gets refreshed, it clears the first shipping address as the selected shipping address - which makes step 2 of checkout not completed.

PascalBrouwers commented 7 years ago

@SerhiyShkolyarenko still not convinced? 3 people are able to reproduce this severe issue.

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers @PieterCappelle @peec of couse I beleive you experienced the issue and I appreciate much you report it and help us to improve Magento. To make sure the issue is fixed we need repeatable steps to reproduce. Let's find them together. This time I tried v2.1.2 in default and production mode and checkout worked fine. @peec and @PieterCappelle have you tried reproducing on latest develop branch?

SerhiyShkolyarenko commented 7 years ago

@peec and @PieterCappelle in case you reproduce the issue on develop branch, could you please check the fix https://github.com/magento/magento2/pull/6870 from @PascalBrouwers? Does it help you?

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers @PieterCappelle @peec which versions of php and mysql do you use?

PascalBrouwers commented 7 years ago

PHP 7.0.11 MySQL 5.7.11

I also had a thought. Maybe it's the browser. I am using Chrome 53.0.2785, what are you using @SerhiyShkolyarenko ?

peec commented 7 years ago

@SerhiyShkolyarenko I use php 7.0.11. (specifcally this docker image).

My full stack: Nginx, Varnish php 7 with php-fpm mysql 5.6

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers i used Firefox 49 for checking this issue.

PascalBrouwers commented 7 years ago

Ah, could you try it with Chrome? I'll see if I can check my Magento 2.1.2 with Firefox then.

PascalBrouwers commented 7 years ago

Ok... the same thing is happening in Firefox. Now with screenshots to show steps:

Create account magento2_issue_6869_1_create_account

Add to cart magento2_issue_6869_2_add_to_cart

From here I went to Cart and Checkout and saw I forgot to add an address. Went back to edit my account.

Edit account magento2_issue_6869_3_edit_account

Add address magento2_issue_6869_4_add_address

magento2_issue_6869_5_address_added

Shopping cart magento2_issue_6869_6_shopping_cart

Checkout step1 magento2_issue_6869_7_checkout_step1

Checkout step2 magento2_issue_6869_8_checkout_step2

Notice the old data being used in step 2: Unites States as the country while I only have an address with The Netherlands as the country.

If I would create and account and directly go to my account and add an address I would end up having a 'half' address here and cannot continue with the order.

@SerhiyShkolyarenko please see if you can reproduce using these steps. So many things are going wrong because old data from storage is being used.

SerhiyShkolyarenko commented 7 years ago

Bingo! I reproduced that! (dancing) @PascalBrouwers between steps 2 and 3 of your initial message was absent a line

Estimate shipping to some other address

Issue doesn't depend on browser. Reproduced both for FF and Chrome. Internal issue MAGETWO-60076. Thank you!

PascalBrouwers commented 7 years ago

Yay! Glad you could reproduce it. You can use my fix in https://github.com/magento/magento2/pull/6870 for this issue.

SerhiyShkolyarenko commented 7 years ago

@PascalBrouwers thanks. We changed this behavior in scope of MAGETWO-56073 and the issue is fixed too. Please, wait for delivery of MAGETWO-56073.

PascalBrouwers commented 7 years ago

Cool, does it also solve the issue with adding a new address during checkout?

SerhiyShkolyarenko commented 7 years ago

No, it doesn't. Created a separate issue for prefilled address form: MAGETWO-60110.

SerhiyShkolyarenko commented 7 years ago

We are closing the issue because MAGETWO-56073 and MAGETWO-60110 are delivered to the develop branch. Thanks for cooperation!

magento-team commented 7 years ago

Internal ticket to track issue progress: MAGETWO-66435

Ctucker9233 commented 6 years ago

@magento-engcom-team What are the commits to this fix on 2.1?