magento2: Billing Address Form does not preload billing address after page refresh when Display Billing Address On is set Payment Page

Preconditions (*)

  1. Magento 2.4.2
  2. Vanilla, clean install with sample-data

Steps to reproduce (*)

  1. Go to admin -> store -> config -> sales -> checkout and set Display Billing Address On to Payment Page
  2. Go to frontend -> add any product to the cart
  3. Go to checkout and fill email, shipping address and choose shipping method
  4. Go to payment step, uncheck My billing and shipping address are the same
  5. Fill new address in the billing address form and click update
  6. Now, refresh the page and click edit on the billing address
  7. Form is empty, without values.

Video: https://www.dropbox.com/s/qqplkwkaqbo0phz/billingAddress-issue.mov?dl=0

Expected result (*)

  1. After filling in the billing address form a different billing address than shipping address and refreshing the page, it should preload the data of the billing address in the form.
  2. Data is there, in the localStorage

PS. all the other components are preloaded: email, shipping address, shipping method, payment method.

Actual result (*)

  1. Form of billing address after refresh page is not preloading the previously saved billing address, which is different than the shipping address.

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I have investigated the issue on M2.4.4 and found the following behaviour. In my example I am using the payment method checkmo. The affected file: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Checkout/view/frontend/web/js/view/payment/default.js

  • Display Billing Address On to Payment Method: The billingAddressCode on line 68 is billingAddresscheckmo. In checkoutProvider there is an empty address object for each payment method called billingAddress + payment code, so in our case it will be billingAddresscheckmo. On line 72 defaultAddressData is not undefined because our billingAddressCode exists in checkoutProvider and so billingAddressData will be the previously added billing address. Everything works fine here. screen01

  • Display Billing Address On to Payment Page: billingAddressCode on line 68 will be billingAddresscheckmo. In checkoutProvider there is a single empty address object called billingAddressshared. On line 72 defaultAddressData is undefined because our billingAddressCode doesn’t exist in checkoutProvider, so we run in the return statement and previously added billing address is not inserted. screen02

The problem is, that billingAddressCode will stay billingAddress + payment code but the object in checkoutProvider changes name to billingAddress + shared.

I don’t know if this is the best solution, but if we change line 68 to billingAddressCode = 'billingAddress' + (window.checkoutConfig.displayBillingOnPaymentMethod ? this.getCode() : 'shared'); everything will work as expected.

Hi @abude , Issue is reproducible on Magento 2.4.2 instance & Magento 2.4 Develop. Hence adding the label ‘Issue confirmed’. Kindly find the attached screenshots for reference.

  1. Go to admin -> store -> config -> sales -> checkout and set Display Billing Address On to Payment Page Payment_Page_Saved
  2. Go to frontend -> add any product to the cart AddedItemtoCart
  3. Go to checkout and fill email, shipping address and choose shipping method
  4. Go to payment step, uncheck My billing and shipping address are the same uncheck1
  5. Fill new address in the billing address form and click update Filled_newaddress
  6. Now, refresh the page and click edit on the billing address Before_refresh
  7. Form is empty, without values. After_refresh_Edit