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
print_r($customerStreet[0]);




#get order details shipping address line 2
        print_r($customerStreet[1]);




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

Comments

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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.

    ReplyDelete
  5. I agree with your point of view of this article. we provide Air Freight Forwarders at affordable cost. to know more visit our website.

    ReplyDelete
  6. This is a smart blog. I mean it. You have an excellent knowledge about this topic. Thanks for sharing such a great blogs to us. USA to Australia Shipping

    ReplyDelete
  7. I really like this post. I've been searching finished for this! Thank heavens I discovered it on your blog . You have filled my heart with joy! Much obliged once more! Continue refreshing more amazing posts.. shipping from china to Amazon FBA

    ReplyDelete
  8. What a great post that you have shared here. You make information effortless for us that we get good facts about it. Thanks for this informative blog.Keep it up. Send Your Parcel From Usa To Kenya

    ReplyDelete
  9. After reading the information you have provided in the post I got some important knowledge from this. Thanks for sharing it. shipping from China to USA FBA

    ReplyDelete
  10. Enjoy reading the article above, it really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles. Small Parcel Audit

    ReplyDelete
  11. These are amazing tips to choose a great shipping company. A reliable freight forwarder company will leverage the logistics structure to meet shipment goals and transport goods from one destination to another. Find a reliable freight forwarder from China to US at chinafreight.com who could improve your logistics flow, streamline your business operations, create new efficiencies, and uncover new ways to reduce the costs associated with your supply chain. Choosing the most reliable, fastest, and economical route to transport goods is the goal of every freight provider. Such a forwarder can also give you expert advice on other logistics-related expenses (such as port expenses, freight expenses, consular fees, insurance fees, cost of merchandise, custom clearance) incurred during the import export process.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Your blog had very good knowledge and that gives huge instructions and that was really commendable ideas you have good knowledge on this topic please share more information with us. shipping from China to Amazon FBA

    ReplyDelete
  14. The article was up to the point and described the information very effectively. Thanks to blog author for sharing an informative post. Secure Courier

    ReplyDelete
  15. I liked your work and the way in which you have shared this article here about parcel contract negotiation It is a beneficial and helpful article for us. Thanks for sharing an article like this.Parcel Contract Negotiation

    ReplyDelete
  16. Because of a splendid exertion in distributing your article. One can be more instructive as this. There are numerous things I can know simply subsequent to perusing your awesome article.Logistic company in Australia

    ReplyDelete
  17. Excellent work. This post that you have shared is attractive. Really, I was searching for these types of blogs. Thank you for sharing this blog. shipping company in Canada

    ReplyDelete
  18. Shipping companies play an important role in the transportation of goods. They can make optimum use of logistics structure to transport your goods from one place of world to another. As a fellow freight company transporting goods and providing metro distribution services, I am glad to come across this article. Thank you for sharing this.

    ReplyDelete
  19. Thanks for publishing such great knowledge. You are doing such a great job. This info Parcel Contract Negotiation is very helpful for everyone. Keep it up. Thanks once again for sharing it.

    ReplyDelete
  20. The delightful article you have posted here. This is a good way to increase our knowledge. Continue sharing this kind of articles, Thank you.Parcel Audit

    ReplyDelete
  21. I liked your work and, as a result, the manner you presented this content about Parcel Audit.It is a valuable paper for us. Thank you for sharing this blog with us.

    ReplyDelete
  22. In addition to hull and prop coatings, there's an excellent extra promising manner to obtain dramatic gasoline financial savings.Shipping from China to Us

    ReplyDelete
  23. Awesome post, you have shared an informative article about Parcel Audit for us. Your method of writing is great. Keep it up.

    ReplyDelete
  24. This article provided me with a wealth of information. The article is incredibly helpful and offers some of the most useful information. Thank you for sharing it with us. Shipping From India To Netherlands

    ReplyDelete
  25. I admire this article for the well-researched content and excellent wording. Read more info about Apparel Buying House in Mumbai. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.

    ReplyDelete
  26. You wrote this post very carefully. The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.Courier Service Dubai To Sharjah

    ReplyDelete

Post a Comment