Skip to content

Conversation

@fballiano
Copy link
Contributor

Summary

  • Fixes a bug where editing a guest order in admin with different billing and shipping addresses caused the shipping address to be overwritten by the billing address
  • Added && !$this->hasSameAsBilling() check to preserve explicitly set same_as_billing values during order conversion

Root Cause

The _populateBeforeSaveData() method in Mage_Sales_Model_Quote_Address unconditionally set same_as_billing for new addresses based on guest customer status, overriding explicitly determined address relationships set during order conversion.

Solution

Modified the condition to check if same_as_billing was already explicitly set before overriding it:

// Before
if (!$this->getId())

// After  
if (!$this->getId() && !$this->hasSameAsBilling())

Credit

Ported from OpenMage: OpenMage/magento-lts#5213

…g order edit

When editing a guest order in the admin panel with different billing and
shipping addresses, the shipping address was incorrectly overwritten by
the billing address during initialization.

The `_populateBeforeSaveData()` method unconditionally set `same_as_billing`
for new addresses based on guest customer status, overriding explicitly
determined address relationships set during order conversion.

Added a check for `!$this->hasSameAsBilling()` to preserve explicitly set
values while maintaining default behavior for truly new orders.

Ported from OpenMage/magento-lts#5213
@fballiano fballiano merged commit ef2f959 into main Jan 9, 2026
23 checks passed
@fballiano fballiano changed the title Fix guest order shipping address overwritten by billing address during order edit Fixed guest order shipping address overwritten by billing address during order edit Jan 9, 2026
@fballiano fballiano deleted the fix/guest-order-address-overwrite branch January 9, 2026 13:28
@fballiano fballiano added this to the 26.1.0 milestone Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants