I'm trying to (re)set the billing address to the customers default billing address after receiving an order (this is for B2B clients which are not allowed to change their billing address). To do this, I have the following code set in a 'checkout_onepage_controller_success_action' event listener. (Limited to customers of a specific customer group)
$customer = $this->customerFactory->create()->load($order->getCustomerId());
$order->setBillingAddress($customer->getDefaultBillingAddress());
$order->save();
But upon ordering this results in a TypeError
TypeError: Argument 1 passed to Magento\Sales\Model\Order::setBillingAddress() must be an instance of Magento\Sales\Api\Data\OrderAddressInterface or null, instance of Magento\Customer\Model\Address\Interceptor given
Is it possible to change the address from a Magento\Customer\Model\Address\Interceptor
to Magento\Sales\Api\Data\OrderAddressInterface
so this will be properly saved/updated?
Or is there another way I can ensure the orders come in with the default billing address set on the customer?