3

I want the detail of orders for a specific product and get the customers detail that which customer had purchased that specified product. How can I know that in Magento 2?

For example: I am having product Chair in my M2 store. I need to know how many orders had been made of that particular product. And how could I know that which customers had purchased that product 'chair'?

2
  • where and how you want this information, i mean you need to create one interface for this?
    – Hiren
    Dec 10, 2019 at 7:24
  • Hi @Hiren, thanks for your reply. I need to know the detail of orders made for a particular order. It can be anywhere in admin or by using a custom script. I just need to know the number of orders made of that specified product. Dec 10, 2019 at 7:29

1 Answer 1

5

Run this sql query in your database

SELECT so.customer_email, soi.sku, soi.name FROM `sales_order` as so left join sales_order_item as soi on so.entity_id = soi.order_id where soi.sku = 'your_product_sku'

Replace your_product_sku with your product actual sku. You can create script also.

Please let me know still if you have any question.

1
  • Thanks @user55548. I got created a custom script and used this query to fetch the records and it gave me what I needed. Thanks alot. Dec 10, 2019 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.