cancel
Showing results for 
Search instead for 
Did you mean: 

Billing Address Retrieves Less Attr Than Shipping Address - Checkout

Billing Address Retrieves Less Attr Than Shipping Address - Checkout

Magento CE 2.4.8

I was trying to add new attribute to addresses across magento (custom address, quote, order). But I ran into a confusing issue.

 

The custom attribute is saved correctly when passed from customer registered address to quote address. But not to sales order.

 

I tried to pin point it, and I found before conversion to sales order, quote calls:

module-quote/Model/Quote.php

public function getBillingAddress()
{
          return $this->_getAddressByType(Address::TYPE_BILLING);
}
 
And this returns an address object without the attributes, even though I can see it in the DB. The shipping address calls the same function and does retrieve the attribute, I tried to follow this path, but I don't see how billing address excludes some fields while shipping address does not. The _getAddressByType function seemingly just filters by address type and nothing else.
 
I even injected a quote repo in my plugin to call this function myself, but ran into the same issue.
 
Does anyone have any insights how does billing address exclude attributes when retrieving address from quote address table? Is it core plugin or something else?

 

1 REPLY 1

Re: Billing Address Retrieves Less Attr Than Shipping Address - Checkout

@mohammadalfb17 

 

Refer to the extension attributes feature to extend the additional attributes in the customer address.

 

https://developer.adobe.com/commerce/php/development/components/add-attributes/

 

Problem solved? Click Kudos and "Accept as Solution".

- rxraj