Change Order Page
Go to => /vendor/magento/module-sales/view/adminhtml/templates/order/view/info.phtml
Find Customer Address Information section.
For Billing Address Replace with –>
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$countryCode = ‘JP’; // Enter country code here
$country = $objectManager->create(‘\Magento\Directory\Model\Country’)->load($countryCode)->getName();
$billingAddress = $order->getBillingAddress();
$name = $billingAddress->getLastname() . ' ' . $billingAddress->getFirstname();
if ($order->getBillingAddress() && $order->getBillingAddress()) {
echo $name . '<br>';
echo $order->getBillingAddress()->getPostcode() . '<br>';
echo $order->getBillingAddress()->getRegion() . '<br>';
echo $order->getBillingAddress()->getCity() . '<br>';
echo $order->getBillingAddress()->getStreet()[0] . '<br>';
$billing = $order->getBillingAddress()->getStreet();
if(array_key_exists(1,$billing)){
echo $order->getBillingAddress()->getStreet()[1] . '<br>';
}
if(array_key_exists(2,$billing)){
echo $order->getBillingAddress()->getStreet()[2] . '<br>';
}
echo __($country) . '<br>';
echo __('T: ') . $order->getBillingAddress()->getTelephone() . '<br>';
}
For Shipping Address Replace with –>
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$countryCode = ‘JP’; // Enter country code here
$country = $objectManager->create(‘\Magento\Directory\Model\Country’)->load($countryCode)->getName();
$shippingAddress = $order->getShippingAddress();
$name = $shippingAddress->getLastname() . ‘ ‘ . $shippingAddress->getFirstname();
if ($order->getShippingAddress() && $order->getShippingAddress()) {
echo $name . '<br>';
echo $order->getShippingAddress()->getPostcode() . '<br>';
echo $order->getShippingAddress()->getRegion() . '<br>';
echo $order->getShippingAddress()->getCity() . '<br>';
echo $order->getShippingAddress()->getStreet()[0] . '<br>';
$billing = $order->getShippingAddress()->getStreet();
if(array_key_exists(1,$billing)){
echo $order->getShippingAddress()->getStreet()[1] . '<br>';
}
if(array_key_exists(2,$billing)){
echo $order->getShippingAddress()->getStreet()[2] . '<br>';
}
echo __($country) . '<br>';
echo __('T: ') . $order->getShippingAddress()->getTelephone() . '<br>';
}
3 thoughts on “Change Order Page Customer Address Information on Magento”
Comments are closed.