Magento2 Get Logged in Customer Data using Email

Magento2 Get Logged in Customer Data using Email

In this Post We Will Explain About is Magento2 Get Logged in Customer Data using Email With Example and Demo.

Welcome on Pakainfo.com – Examples ,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Get Customer detail in magento2

In this post we will show you Best way to implement How to get Customer collection in magento2, hear for How to magento 2.0 – Get customer data from id – magento2 with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Also Read :  Top 10 Common PHP Job Interview Questions and Answers

How to get customer data from email id in magento 2

For Get Magento 2 Get Customer Details using Email Id

There are the Following the Two step include to get Magento 2 Get Customer all Details
Step 1 : If you have simple email id of customer and you need to get all the details of customer
Step 2 : This source code will return all the customer object details and fill detail

$mage_query_boot = Bootstrap::create(BP, $_SERVER);
$object_manager = $mage_query_boot->getObjectManager();
 
// add ustomer email
$set_cust_email = "[email protected]";
// echo $set_cust_email;
 
// Get simple object manager using magento 2 
$object_manager = \Magento\Framework\App\ObjectManager::getInstance();
 
 
$mage_url = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $mage_url->get('\Magento\Store\Model\StoreManagerInterface');
$state_val = $object_manager->get('\Magento\Framework\App\State');
$state_val->setAreaCode('frontend');
 
//Pakainfo.com to Get website id
$get_web_id = $storeManager->getWebsite()->getWebsiteId();
 
$store = $storeManager->getStore();
// Get Store ID
$store_id = $store->getStoreId();
 
$customer_factory = $object_manager->get('\Magento\Customer\Model\CustomerFactory');
$all_cust_data = $customer_factory->create();
 
$all_cust_data->setWebsiteId($get_web_id);
$all_cust_data->loadByEmail($set_cust_email);
// load simple customer by email address
// pront simple customer basic id 
// simple step sto Magento 2 Get Customer name
echo $all_cust_data->getFirstname();
echo $all_cust_data->getLastname();
echo $all_cust_data->getEmail();
 
 
//$all_cust_data->load('1');
 
// load customer by email address
$data = $all_cust_data->getData();
 
$customer_id = $data['entity_id'];

echo "Check Here print to all the data display";
echo "<pre>";
print_r($data);
echo "</pre>";

Example

Also Read :  PHP Get Current URL Full Path HTTP-HTTPS Protocol

I hope you have Got Get all the customer details by email id In Magento And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Recommended For You.

Laravel Validation Unique Soft Delete Example
Today, We want to share with you Laravel Validation Unique Soft Delete Example.In this post we will show you laravel

Add a Comment

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