0

I am updating the product name and it only affects the En store view I want to update product name for all store views and main website as well. see the sample code below

   $sku = 'E20630';
    $product = $this->getProductBySku($sku);
    if ($product) {
        $product->setName('New Name');
        $this->productRepository->save($product);
        $response = ['success' => 'ok', 'message' => 'product updated'];
        header('Content-Type: application/json');
        echo json_encode($response); exit;
    }

For En store product name is changed enter image description here

For All Store Views, product name is not changed enter image description here

0

It seems that your endpoint only points to the EN scope, your default view.

If you connect to endpoints /rest/V1/products the data is stored in the default store view. Write to the globale scope can be done with endpoints like this: /rest/all/V1/products. On the other hand you can use the "storeviewcode" to update specific views. For this task you can adapt your path in following way: /rest/{storeviewcode}/V1/products.

You will also find your answer in Thread Scope of Endpoints.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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