I have 4 store view. In this store view i have products. Store view differ in the names of products. I want to fetch product only from one storeview. Now i can fetch product from main, first store view. How can i switch store view to fetch product from second store view where product have different name.


1 Answer 1


As per my understanding, i think you have to get store specific product name and other product data. you can achieve these things using below code.

Load product factory in construct method

protected $_productFactory;

public function __construct(     
    \Magento\Catalog\Model\ProductFactory $_productFactory
) {
    $this->_productFactory = $_productFactory;        

Now you can use like below.

$product= $this->_productFactory->create()->setStoreId($storeId)->load($pid);

Where $storeId is your store Id and $pid is your product Id.

You can also use product repository (\Magento\Catalog\Api\ProductRepositoryInterface $productRepository) instead of product factory (\Magento\Catalog\Model\ProductFactory)

I hope it helps!

Your Answer

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

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