Get Customer Shipping address from order in magento 2 Object:

Get Customer Shipping address from order in magento 2 Object:

Below code snippet will helpful to retrive the shipping address information in magento 2.

Using object manager here am getting store details. We can also get the information via DI.

 

$orderID = ‘111’;

$orderObj = $objectManager->create(‘Magento\Sales\Model\Order’)->load($orderID);

$shippingAddressObj = $orderObj->getShippingAddress();

$shippingAddressArray = $shippingAddressObj->getData();

$firstname = $shippingAddressArray[‘firstname’];

$lastname = $shippingAddressArray[‘lastname’];

$telephone = $shippingAddressArray[‘telephone’];

$street = $shippingAddressArray[‘street’];

$city = $shippingAddressArray[‘city’];

$email = $shippingAddressArray[’email’];

$region = $shippingAddressArray[‘region’];

$postcode = $shippingAddressArray[‘postcode’];

$paymentType = $orderObj->getPayment()->getMethodInstance()->getCode();

 

The real government is the people who respect the word of the people
#Save Kathiramangalam

Leave a Reply