Magento 2 How to get Customer Shipping Address Street Line 2 details

To get Customer address street second line details from magento 2 we need to split the data as the

data is present in the form of an array, so you can store values in the variable and split the value of

the array to get the customer street address details , the below code logic might help you to get the details

    $orderId = 1;

     $orderDetailsArray = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);

      $shippingDetailsData =$orderDetailsArray->getShippingAddress();

$customerStreet = $shippingDetailsData->getStreet();

#get customer shipping street

#get order details shipping address line 1

#get order details shipping address line 2

Explanation for the above code is given below , first we are loading the order object . For the order object

we will pass the order id of the order increment id , the following order id loads the data from the database

tables, when the data is loaded we will try to get the shipping details of the customer from the order details

by using the following method $orderDetailsArray->getShippingAddress();  

The shipping address loads the complete shipping information of the order, when you try to get the 

street details from the shippingAddress object and try to echo you will get a Notice : Array to string 

conversion in line number on your screen , this is becuase the street details is present in the form of 

the array, to get the details of the array , you will need to parse the array , so we can store it one 

variable  called as $customerStreet  , the following details can be passed by using the key of the 

array and you will be able to echo the customer street 1 and customer street line 2 from the 

address details


  1. Wonderful article, Which you have shared about the service. Your article is very important and I really enjoyed reading it.
    freight shipping miami

  2. i found new platform thru this weblog and got to understand who i am capable of cope with burden of lot many essay writing tasks. Now i am feeling rate after segregation of my paintings over unique writers over net. Movers And Packers In Jaipur

  3. Such a lovely collection about shipping which you have shared here. I liked your way to express your views in this post. Thank you for sharing this blog with us. shipping from China to USA

  4. The most obvious advantage sea offers are the affordability, when it comes to choosing the modes of transportation always choose the one that suits you the most. You can hire shipping from China to UK for more information. Based on my experience the most obvious advantage that ships can carry all kinds of rather heavy goods irrespective of the distance.


Post a comment