I am creating new import module and I have issue with new created Product. Product doesn't want to create:

In StockRegistry.php line 194:

  The Product with the "13.111.116" SKU doesn't exist.  

My code is:

/** @var Product $product */
$product = $this->productFactory->create();
$sku = $item->getSku();
$description = $item->getDescription();
$name = explode(',', $description);
if (key_exists(0, $name)) {
$qty = $item->getAvailableQuantity();
$isAvailable = ($qty > 0 && strcmp($item->getAvailabilityCode(), 'available') === 0);
$extensionAttributes = $product->getExtensionAttributes();
/** @var StockItemInterface $stockItem */
$stockItem = $extensionAttributes->getStockItem() ?: $this->stockItemInterfaceFactory->create();
$this->productRepository->save($product, true);

I am getting exception on save step. Adding product via API is working. I think it can be problem with AreaCode or MySQL. If I save via Product Resource Model, I am getting Lock wait timeout exceeded.

Maybe some one know solution. I tried different ways to save

Your Answer

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

Browse other questions tagged or ask your own question.