I need the number of orders made by each product.
I have the object
\Magento\Catalog\Model\Product
With that object I can retrieve the Id, price, name, etc. But no idea how to get the number of orders made. Don't see any method to achieve that. There are getQty()
that I really don't know what retrieves. it's always null.
I only have the alternative to search the object "sells" or something like that, loop it and retrieve all sells made with that product. but c'mon, I think it has to be an easier way.
Best Answer
You can use following code to get Number of time product ordered