1

I created an observer for this event

sales_order_address_save_before

<?php
namespace UV\Adressen\Observer;

use Magento\Framework\Event\ObserverInterface;

class LieferadresseEditObserver implements ObserverInterface
{
  private $customerRepository;

  public function __construct()
  {

  }

  public function execute(\Magento\Framework\Event\Observer $observer)
  {
    print_r(get_class_methods($observer));
    exit;
  }
}
?>

However how can I get the changed address and how can I see if it is a shipping or a billing address? thanks!:-)

2
  • Could you tell us where is this event (sales_order_address_save_before) declared? Is it in your custom module?
    – Haritha
    Commented Apr 26, 2018 at 11:36
  • it's built in magento. Commented Apr 26, 2018 at 11:53

2 Answers 2

1

Try using observer for sales_order_place_before event

<?php
namespace UV\Adressen\Observer;

use Magento\Framework\Event\ObserverInterface;

class LieferadresseEditObserver implements ObserverInterface
{

  public function execute(\Magento\Framework\Event\Observer $observer)
  {
    $order = $observer->getEvent()->getOrder();

    $order->setBillingAddress($order->getShippingAddress());

  }
}
?>
0

Solution:

$address = $observer->getEvent()->getAddress();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.