0

I want to retrieve orders of a specific store? Is there any way to achieve it. R&D just gave me methods to get store id from order or get store/customer information using order. But i have not found anything which helps me to fetch the orders collection of a specific store

1 Answer 1

3

In your constructor, import

\Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory 

and set

$this->_orderCollectionFactory = $orderCollectionFactory; 

and if you already have a way of obtaining the store ID you should be able to call it by passing it in like:

public function getOrderCollectionByStoreId($storeId) { $collection = $this->_orderCollectionFactory->create() ->addAttributeToSelect('*') ->addFieldToFilter('store_id', $storeId); return $collection; } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.