← Back to templates
Data Workflow Automation Template

Export Magento 2 Customers with Orders (Aggregated)

Pull customer and order information with direct MySQL queries and aggregate.
Try this flow for free ->
Use Template
Import template to workspace
Copy template to clipboard (JSON)
Copied! Next, paste into your Mipler workflow canvas
Schedule an onboarding call
customers

Trusted by 4,150+

Export Magento 2 Customers
More than 4,150+ organizations worldwide rely on Mipler
wahl mothercare zmew krea whisky vapenv

There are two ways to fetch customers from Magento: via REST API and via direct MySQL queries.

Magento 2 has a very stable REST API, but due to limitations of server resources, it is slow to extract a large amount of information and additionally not as flexible as direct queries to the database. The Magento API can effectively be used to fetch small parts of information or for updating data. In other cases, direct SQL queries are preferred.

How Does It Work?

The flow uses direct database queries to fetch information about customers and orders. It then joins customers and orders to calculate a few derived columns for each customer:

  • Number of Orders - The total number of orders per customer
  • Total Amount - The total amount of orders placed by the customer
  • First Order Date - The date of the first order placed by the customer
  • Last Order Date - The date of the most recent order placed by the customer

To use this workflow, you will need to:

  • Add credentials to connect to your Magento 2 database (you can connect directly to the database or use an SSH tunnel)
  • Set table prefixes in MySQL steps (if you use any prefixes).
  • Add extra steps to format the information the way you need.

Pull list of Magento 2 orders

Use the 'Pull from MySQL' step to fetch a list of all orders into the flow.

Pull list of Magento 2 customers

Use the 'Pull from MySQL' step to fetch a list of all customers into the flow.

Combine tables

Join the orders and customers into a single table for the next processing step.

Summarize (Group By)

Summarize data by customer email.

During summarization, calculate the derived columns: number of orders, total amount, first order date, and last order date.

Main Use Cases

  • Export Magento 2 customers
  • Prepare files for importing Magento 2 customers to Mailchimp
  • Build reports by customers
  • Customer segmentation

Possible Extensions

As with all other flows, this one can also be extended with various additional steps like sending results by email or publishing results with a private link.

Another option is using results to integrate with other systems, like Microsoft PowerBI, where results are exported as JSON and then imported to PowerBI.