Skip to main content
added 296 characters in body
Source Link
Rajkumar Elumalai
  • 3.6k
  • 8
  • 43
  • 74

I think you mismatch object to save a update product info. I tried blow code using corn its works for me.

 $product = $this->productRepository->getById($product_id); $product->setName("Testing"); $product->save(); 

Update:

I saw vendor/magento/module-catalog/Model/ProductRepository::save() same way to save product, its works for me.

I use

 $this->productRepository->save($target, $saveOptions = false); 

Instread of below line

 $this->productRepository->save($target); 

I think you mismatch object to save a update product info. I tried blow code using corn its works for me.

 $product = $this->productRepository->getById($product_id); $product->setName("Testing"); $product->save(); 

I think you mismatch object to save a update product info. I tried blow code using corn its works for me.

 $product = $this->productRepository->getById($product_id); $product->setName("Testing"); $product->save(); 

Update:

I saw vendor/magento/module-catalog/Model/ProductRepository::save() same way to save product, its works for me.

I use

 $this->productRepository->save($target, $saveOptions = false); 

Instread of below line

 $this->productRepository->save($target); 
Source Link
Rajkumar Elumalai
  • 3.6k
  • 8
  • 43
  • 74

I think you mismatch object to save a update product info. I tried blow code using corn its works for me.

 $product = $this->productRepository->getById($product_id); $product->setName("Testing"); $product->save();