Magento 2 How to get Customer Billing Address from the order number
In ecommerce application when a customer places the order , the customer needs to fill the Billing
address , this Billing address will be used to deliver the product to the customer doorstep. The
Billing address of the customer is store in the magento 2 and is associated with the order details, to
get the customer Billing 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);
$BillingDetailsData =$orderDetailsArray->getBillingAddress();
#get customer Billing Region
echo $BillingDetailsData->getRegion();
#get customer Billing Postcode
echo $BillingDetailsData->getPostcode();
#get customer Billing LastName
echo $BillingDetailsData->getLastName();
#get customer Billing street
print_r($BillingDetailsData->getStreet());
#get customer Billing City
echo $BillingDetailsData->getCity();
#get customer Billing Email
echo $BillingDetailsData->getEmail();
#get customer Billing Telephone
echo $BillingDetailsData->getTelephone();
#get customer Billing suffix
echo $BillingDetailsData->getSuffix();
#get customer Billing vatid
echo $BillingDetailsData->getVatId();
In ecommerce application when a customer places the order , the customer needs to fill the Billing
address , this Billing address will be used to deliver the product to the customer doorstep. The
Billing address of the customer is store in the magento 2 and is associated with the order details, to
get the customer Billing 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);
$BillingDetailsData =$orderDetailsArray->getBillingAddress();
#get customer Billing Region
echo $BillingDetailsData->getRegion();
#get customer Billing Postcode
echo $BillingDetailsData->getPostcode();
#get customer Billing LastName
echo $BillingDetailsData->getLastName();
#get customer Billing street
print_r($BillingDetailsData->getStreet());
#get customer Billing City
echo $BillingDetailsData->getCity();
#get customer Billing Email
echo $BillingDetailsData->getEmail();
#get customer Billing Telephone
echo $BillingDetailsData->getTelephone();
#get customer Billing suffix
echo $BillingDetailsData->getSuffix();
#get customer Billing vatid
echo $BillingDetailsData->getVatId();
Comments
Post a Comment