I need to save the shipping address while order is placed in my custom table how to i take the shipping address . I am using the event sales_order_payment_save_after and did the following codes

$shippingAddress = $order->getShippingAddress();
 $city = $shippingAddress->getCity();
 $state = $shippingAddress->getRegion();
$countryData = $this->countryInformation>getCountryInfo($shippingAddress->getCountryId());
$country = $countryData->getFullNameLocale();

It is not return any result . how to i get the shipping addess

  • Order is placed in my custom table means?
    – Keyur Shah
    Commented Dec 19, 2018 at 8:14
  • @KeyurShah I have a custom table. i need to save order details in my table while order is placed . so i use the event "sales_order_payment_save_after" . when the event is called i am not able to get the orders shipping address Commented Dec 19, 2018 at 8:15

1 Answer 1


You can try something like this:

use Magento\Checkout\Model\Session as CheckoutSession;

public function __construct(
    CheckoutSession $session,
    $this->session = $session;
public function execute(Observer $observer)
    $quote = $this->session->getQuote();
    $shipping = $quote->getShippingAddress();

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.