Customer retention is very important in online business. An online store owner may want to reward his loyal customer in order to build a better customer relationship.
For doing so, the store owner may require to get all orders of customer by email id in Magento 2.
This post offers the programmatic solution for the same.
One can fetch the entire collection of orders along with the order date, total items, and related information.
The admin may reward the loyal customer with maximum order by offering a discount or gift hamper. He can decide so by getting all the orders of a customer by their Email ID in Magento 2 store.
It is pretty complex to get a specific customer’s list of orders out of the bulk of orders in Magento 2 store. However, I’ve made this task pretty simple using the below programmatic solution:
Method to Get All Orders of Customer by Email ID in Magento 2
Use the below code in your block file at Vendor\Module\Block.
class CustomerOrder extends Template
public function __construct(
array $data = 
$this->orderCollection = $orderCollection;
$this->logger = $logger;
public function getCustomerOrder()
$customerEmailId = "[email protected]"; // pass customer Email Id
$customerOrder = $this->orderCollection->create()
If you have any doubts regarding this post, just mention them in the Comments section below.
I would be glad to help.
Feel free to share the solution with Magento Community via social media.
Get Weekly Updates
Never miss Magento tips, tricks, tutorials, and news.
Thank you for subscribing.
Something went wrong.