Replies: 4 comments
-
@piotrpog What is your use case? cause new address is always created to relate it to an order. |
Beta Was this translation helpful? Give feedback.
-
@pdaleramirez |
Beta Was this translation helpful? Give feedback.
-
Thanks for the request. We have added it as an enhancement request. In the mean-time you will need to figure out another way. On order complete, you could loop over the customers address book and remove the addresses that are the same as the one attached to the order. Something like: Event::on(
Order::class,
Order::EVENT_AFTER_COMPLETE_ORDER,
function(Event $event) {
// @var Order $order
$order = $event->sender;
foreach (Plugin::getInstance()->getAddresses()->getAddressesByCustomerId($order->customerId) as $address)
{
if ($address->sameAs($order->getShippingAddress()))
{
Plugin::getInstance()->getAddresses()->deleteAddressById($address->id);
}
}
}
); |
Beta Was this translation helpful? Give feedback.
-
@lukeholder |
Beta Was this translation helpful? Give feedback.
-
I am lf course talking about situation when user is logged in.
Would that be possible?
Beta Was this translation helpful? Give feedback.
All reactions