How to get Shipping and Billing address from Order in magento 2?

In Magento 2 we can get Customer billing and Shipping address by order id using below code snippet,
Sometimes we required billing or shipping address of specific order placed by the customer we can get billing and shipping address by order id,
Using Block file get customer order’s billing and shipping address,

Call a required function in the template file, You need to pass Order id to below function. Using Order Id we can get Customer billing and shipping address id and based on respective id we can get billing and shipping address.


How to Create customer and add new address programmatically in magento 2?

To creating customer and customer address programmatically in Magento 2 using below code snippet. Just Pass $customerInfo array to a block function .

Given below code checks, Customer is existed or not using email id. If the customer is new, Add a new customer and add given address to the same customer otherwise display already exist customer message.

In Block file, Pass customer required data from above $customerInfo array,

Run indexer command to see a customer in the admin panel,