0

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!:-)

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

Solution:

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

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());

  }
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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