I have a custom function that is triggered with event sales_order_place_after, I need to retrieve the shipping address in this function.
I tried $observer->getCustomerAddress()
, but it didn't work. How could I get the shipping address?
This is my function
public function SalesOrderPlaceAfter($observer)
{
$orderIds = $observer->getEvent()->getOrder()->getId();
if (!empty($orderIds))
{
//This get me the shipping method. it's working.
$shipping_method = $observer->getEvent()->getOrder()->getShippingMethod();
// this is not working, How can I get the shipping address?
$shipping_address = $observer->getEvent()->getOrder()->getShippingAddress();
}
}
Observer.php
code to the question?