Get customer data in magento 2
Get customer data in magento 2 : In magento 2 it is different to access the customer data than magento 1.x. Object Manger ($objectManager = \Magento\Framework\App\ObjectManager::getInstance();) is used to access the customer object. Here in this tutorial we are going to explain how you can access the customer data in magento2.
Get customer data in magento 2
Use $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); and get customer data using the customer id as –
Get customer data in magento 2: customer data from id in magento2
$customerId = 100; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customerId); |
Thus you can get the customer data from customer in magento 2. The above example will give the data of customer id 100. You can get the customer information such as name, email phone etc from the above example.
Advertisements