QUESTION:

Our prices get pushed to us from a 3rd party system and we update them via code, I wonder if there is a specific function I can use to update the price for a specific store view via code?


ANSWER:

If you want to update the price per store view via code, you can use the function addAttributeUpdate($attrCode, $value, $scope)


For example: 

$product = $productRepository->getById($productId);

$product->addAttributeUpdate('price', 150000, $storeId1);

$product->addAttributeUpdate('price', 25, $storeId2);


Then, kindly remember to reindex the products that have just been updated.


If you need any further assistance, please feel free to contact us. We'd be happy to support you!