Skip to content

Magento 2 setStoreId VS setCurrentStore

What is the exact(!) difference between:

  • setStoreId()
  • setCurrentStore()

Example where the two give different results.

// setStoreId solution    
$product = $objectManager->create('MagentoCatalogModelProduct')->setStoreId(2)->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue();

VS

// setCurrentStore solution    
$storeManager->setCurrentStore(2);
$product = $objectManager->create('MagentoCatalogModelProduct')->load(1);
echo $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue();

EDIT: I am getting different results when there is a catalog price rule active on just one of the two stores.