I have to filter the products by store. However, after trying several times for almost a day, I can not filter products by store.
$ objectManager = Magento Framework App ObjectManager :: getInstance (); $ productCollectionFactory = $ objectManager-> get ( Magento Catalog Template Resource Model Product CollectionFactory & # 39;); $ collection = $ productCollectionFactory-> create (); // filter products from the current store $ collection-> addStoreFilter (); $ collection-> addFieldToFilter (& # 39; entity_id & # 39; ['in' => $best_selling_product_id])
$ best_selling_product_id is a table of product ID. However, the code above returns products from all stores.
Can someone help me here?