I recently tried to update some product-information on the default storeView (id 0). Instead of applying the changes to the default store, it instead applied them to the product in the next higher increment of storeIds. I then tried to get all available storeIds for the product and the default store was not listed. Is it not possible to make changes to the default storeView programmatically?
yes, it is possible to add values directly to the default store view for any product. By default, all products belong to the default store view, there is no need to somehow assign them there.
this can be seen in action when you save a value in admin in the 'all store views' scope (which is the default store with id 0) as opposed to having a value on say 'default store view' (with id 1).
just play a little in your admin and you will see the difference.
the default store view is not counted as a storeview per se and that's why you don't see it returned in the query for the retrieval of the product storeviews.
The problem I was encountering was only present when using the ProductRepository-class to try and update the product in question.
I got it to work by using the following code:
$storeId = 0; $productCollectionFactory = $objectManager->get(CollectionFactory::class); $action = $objectManager->create(Action::class); $updateAttributes['name'] = "test"; $action->updateAttributes([$product->getId()], $updateAttributes, $storeId);