magento2 Get billing and shipping address on checkout page

magento2 Get billing and shipping address on checkout page

In this post we will show you magento2 Get billing and shipping address on checkout page, hear for magento2 Get billing and shipping address on checkout page we will give you demo and example for implement.

how magento2 Get billing and shipping address on checkout?

To get the billing and shipping address in magento2, we have to use the following code.

<?php
$object_manager = \Magento\Framework\App\ObjectManager::getInstance();
$get_cart = $object_manager->get('\Magento\Checkout\Model\Cart');

$get_billingaddress = $get_cart->getQuote()->getBillingAddress();
echo '<pre>'; 
// billing Address data
print_r($get_billingaddress->getData()); 
echo '</pre>';

$get_shippingaddress = $get_cart->getQuote()->getShippingAddress();
echo '<pre>'; 
// shipping Address data
print_r($get_shippingaddress->getData()); 
echo '</pre>';

?>

Hope this code and post will helped you for implement how magento2 Get billing and shipping address on checkout page. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Leave a Comment

Your email address will not be published. Required fields are marked *

1  +  3  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US