Open coolio986 opened 6 months ago
I may have found what looks like it could be the issue. The Inventory Tracking GUIDS are stored as a single array in settings (zettlesettings.inventorytrackinggids). When multiple items are added and sync'd, multiple webhook requests come in, and multiple writes occur to that array out of order. This causes the data to be overwritten from whichever requests happens first (or if multiple happen at the same time) those don't get written.
The tracking gids should be stored as multiple line items in the DB, not as a single object array
Using nop 4.70 with the zettle 4.50 plugin ported to 4.70.
When adding new inventory items with inventory tracking enabled, the inventory doubles due to the webhook being called to update inventory after creation.
I have added logging into the relevant sections to help me debug since this is an active site that I am unable to connect a debugger to.
This product I am trying to sync has an inventory level of 17.
Here is the data below:
Then a product creation webhook occurs:
UpdateInventoryBalanceAsync is called by webhook "ProductCreated"
The problem appears to be the below item, webhook "InventoryBalanceChanged"
During the inventory update, "balanceBefore" is 0, and "balanceAfter" is 17.
This looks incorrect to me. The ProductCreated webhook clearly has "change" 17.