2

We get a lot of this type of notice in our system.log, but can't see what is causing this critical notice.

Framework: Magento M2 2.3.3

Have anyone seen this before ?

[2019-11-14 14:00:08] main.CRITICAL: The stock item with the "37520" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:13] main.CRITICAL: The stock item with the "39393" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:14] main.CRITICAL: The stock item with the "5610" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:19] main.CRITICAL: The stock item with the "10691" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:20] main.CRITICAL: The stock item with the "20589" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:22] main.CRITICAL: The stock item with the "47337" ID wasn't found. Verify the ID and try again. [] [] [2019-11-14 14:00:30] main.CRITICAL: The stock item with the "13366" ID wasn't found. Verify the ID and try again. [] []

Hi, check my response. Mark question as answered, if it works for you.

2
  • 1
    Any solutions for that? – mahmoudismail Nov 17 '20 at 9:14
  • THANK YOU - Saved me! Damit FACEBOOK... – Tony Hernandez Dec 14 '20 at 3:34
3

I had the same problem. Following the solution by @hitesh-kashyap, I was able to modify the the following code.

Problem: When the BuildProductRequest function is called in the ProductFeed class it creates a StockItemRepository object. If the product is a new product an exception is thrown because the newly created product does not have a record on the cataloginventory_stock_item table yet.

Solution: Add a try catch section to Facebook/BusinessExtension/Model/Feed/ProductFeed.php

  1. Replace
$stock = $this->_fbeHelper->createObject(StockItemRepository::class)->get($product->getId());

With

   $productQty = 0;
   $productIsInStock = 0;

   try {
           $stock = $product->getExtensionAttributes()->getStockItem();
           if($stock){
                   $productQty = $stock->getQty();
                   $productIsInStock = $stock->getIsInStock();
           }
   } catch (Exception $e) {}
  1. Replace
       self::ATTR_AVAILABILITY => $this->buildProductAttr(self::ATTR_AVAILABILITY, $stock->getIsInStock() ? 'in stock' : 'out of stock'),

with

       self::ATTR_AVAILABILITY => $this->buildProductAttr(self::ATTR_AVAILABILITY, $productIsInStock ? 'in stock' : 'out of stock'),
  1. Replace
       'inventory' => $stock->getIsInStock(),

With

       'inventory' => $productQty,

Finally, save the file.

Limitations, at the time you create a product the stock information will be 0 and out of stock. You will need to save the product a second time to update the stock information on Facebook.

Tested on Magento 2.3

3
  • I had exact same scenario and the fix worked. At a glance the Facebook logic is sound. I can only assume it's because they've made heavy use of the object mananger and are therefore not using M2 as intended – Dominic Xigen Jan 20 at 10:00
  • @Rayed, Thanks for this fix. And is that any workaround for saving the new product a second time to update the stock information on Facebook? – Ramya Jan 21 at 6:03
  • @Ramya, you are welcome. Glad it worked for you. – Rayed Jan 29 at 21:57
1

Error While Saving The Products : The stock item with the “37520” ID wasn't found. Verify the ID and try again.

Solution: In my case. This error comes after installing Magento2Facebook Pixel Extension. In which module fetching Inventory using StockItemRepository. This only works when product id and item id same in database(in my database it's not same).

1,) first find the file containing StockItemRepository Code in Module which cousing this issue. Download the file for backup. 2,) Now change every line of code containing StockItemRepository to comment.

3,) Open any product in backend and try to save it. you will find some error with row number details which causing issue. You need to comment that lines also. Refresh the product page and save product again. Your product will save or you will get another error in another php row. Comment that line also and repeat this step again and again untill your product got saved.

Note: This solution will disable the inventory fetch function of the module. If anyone have alternative method to resolve StockItemRepository issue. Please comment

Solution to resolve this issue.

Fix 2: I just disabled and uninstall the facebook Extension the Problem got fixed and in alternative i start using " Sparsh Facebook Pixel" Free Extension Which is now working Perfectly. But you have to use another method to bulk upload products to Facebook because this extension not supported feed. But it can track all conversions and other analysis required for Facebook. I am running conversion based ads now. enter image description here

1
  • You need to update the extension. It is fixed in newer version ! :) – K. Maliszewski Mar 24 at 8:39
0

Facing same issue after installing Facebook Business Extension.

Here is the screenshot of the error after saving product

Database have ID and stock in inventory_source_item

If anyone know how to resolve it please reply.

2
  • Did you found a solution? – MagEGY Dec 14 '20 at 18:52
  • Yes, I just disabled and uninstall the facebook Extension the Problem got fixed and in alternative i start using " Sparsh Facebook Pixel" Free Extension Which is now working Perfectly. But you have to use another method to bulk upload products to Facebook because this extension not supported feed. But it can track all conversions and other analysis required for Facebook. I am running conversion based ads now. – Hitesh Kashyap Dec 16 '20 at 10:11

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.