Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Example1: After altering a profile at checkout you progress to the overview page. When deciding to go back using the "Go back" form button, the altered values are being overwritten by Commerce Extra Address Populate.
Example2: When leaving the checkout progress after altering a profile and then returning to the checkout pages, the altered values are being overwritten by Commerce Extra Address Populate.
This can be overcome by checking whether the field has a value or not by changing lines 79-81 at commerce_extra_address_populate.module from:
if (isset($form['commerce_customer_address'][$langcode][0]['#address'][$key])) {
$form['commerce_customer_address'][$langcode][0]['#address'][$key] = $value;
}
to:
if (isset($form['commerce_customer_address'][$langcode][0]['#address'][$key]) && empty($form['commerce_customer_address'][$langcode][0]['#address'][$key])) {
$form['commerce_customer_address'][$langcode][0]['#address'][$key] = $value;
}
Thanks a lot for the effort!
Comments
Comment #1
5n00py CreditAttribution: 5n00py commentedThank you for your report, it need to be fixed!
I will do this soon.
Comment #2
5n00py CreditAttribution: 5n00py commentedI think would be better to populate data only one time.
Simple use case is:
Diff
Committed to 7.x-1.x
Comment #3
lmeurs CreditAttribution: lmeurs commentedYes, that makes more sense, otherwise empty fields would always be repopulated, also when they were left blank on purpose.