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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s