Magento 2 How to get Customer Shipping Address from the order number
In ecommerce application when a customer places the order , the customer needs to fill the shipping
address , this shipping address will be used to deliver the product to the customer doorstep. The
shipping address of the customer is store in the magento 2 and is associated with the order details, to
get the customer shipping address details and display in your application you can do it with the order
object
$orderId = 1;
$orderDetailsArray = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);
$shippingDetailsData =$orderDetailsArray->getShippingAddress();
#get customer shipping Region
echo $shippingDetailsData->getRegion();
#get customer shipping Postcode
echo $shippingDetailsData->getPostcode();
#get customer shipping LastName
echo $shippingDetailsData->getLastName();
#get customer shipping street
print_r($shippingDetailsData->getStreet());
#get customer shipping City
echo $shippingDetailsData->getCity();
#get customer shipping Email
echo $shippingDetailsData->getEmail();
#get customer shipping Telephone
echo $shippingDetailsData->getTelephone();
#get customer shipping suffix
echo $shippingDetailsData->getSuffix();
#get customer shipping vatid
echo $shippingDetailsData->getVatId();
In ecommerce application when a customer places the order , the customer needs to fill the shipping
address , this shipping address will be used to deliver the product to the customer doorstep. The
shipping address of the customer is store in the magento 2 and is associated with the order details, to
get the customer shipping address details and display in your application you can do it with the order
object
$orderId = 1;
$orderDetailsArray = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);
$shippingDetailsData =$orderDetailsArray->getShippingAddress();
#get customer shipping Region
echo $shippingDetailsData->getRegion();
#get customer shipping Postcode
echo $shippingDetailsData->getPostcode();
#get customer shipping LastName
echo $shippingDetailsData->getLastName();
#get customer shipping street
print_r($shippingDetailsData->getStreet());
#get customer shipping City
echo $shippingDetailsData->getCity();
#get customer shipping Email
echo $shippingDetailsData->getEmail();
#get customer shipping Telephone
echo $shippingDetailsData->getTelephone();
#get customer shipping suffix
echo $shippingDetailsData->getSuffix();
#get customer shipping vatid
echo $shippingDetailsData->getVatId();
Comments
Post a comment