Facing issue with inventory_subtract mutation

Hi!
I am facing an issue when trying to use inventory_subtract , getting the error that product does not exist. While i confirmed that product exist and its in the correct warehouse assigned whose ID i am using in the mutation. The request id is 6554b016060739fd1710bcbc

Hello @saif_storage!

Thanks for reaching out!

Let me investigate, and I will get back to you with an answer soon.

Have a nice day!
TomasFD

Hello @saif_storage!

That mutation was deprecated last year. Can you try using inventory_remove?

Please let me know how that goes!

TomasFD

Hello @tomasfd the mutation you shared works and getting success in the API response but cant find any change in the inventory. I tried it twice, got success from the API response but no change in inventory and no entry in inventory log. Request ID for the last request is 6554ffb1805a31d58513a512 if this helps to understand.
Thanks alot for the support

Hello @saif_storage!

I can see the inventory movement for that product.

If you check the inventory log, you will see the last line has the same timestamp as your mutation, and the change is the removal of 4 items. The old on hand is 5, and the new on hand is 1.

Make sure you are checking the instance of the product in the right warehouse, as you have it in 2 different warehouses.

Have a nice day!
TomasFD

Hello @tomasfd
We have 2 issues here,

  1. The inventory update is not showing in the admin account. Could you check please?
  2. The changed inventory did not work as expected, looks like it changed from 100 to 5 while it was supposed to reduced the inventory by 5 so it should be 95, please correct me if i am wrong here. I had used inventory_remove mutation. And also it did not reduce the inventory from available quantity.
    Could you help with these please?
    Thanks alot

Hey @saif_storage,

Thanks for hanging in there!

Could you please share the request_id(s) for the mutations you’re referencing in your latest comment?
I’m more than happy to take a look!

Please let me know if you have any questions or concerns.

Best,
RayanP

Hello @sh-agent
The request ID is same as shared previously which is 6554ffb1805a31d58513a512
Thanks

Hello @saif_storage,

Thanks for hanging in there!

It looks like the inventory_remove mutation was successful. For Request ID 6554ffb1805a31d58513a512, the mutation that ran was:

"query":"            mutation{\n              inventory_remove(\n              data:{\n                sku : \"Darkk\"\n                warehouse_id : \"V2FyZWhvdXNlOjk2Mzgx\",\n                quantity : 4\n              }){\n                request_id\n                complexity\n                warehouse_product{\n                    id\n                    account_id\n                    on_hand\n                    inventory_bin\n                }\n              }\n            }"}

Basically just subtracting 4 quantity from said SKU. Which I can see happened in the inventory log:

When making inventory changes, it’s advised to make the change from the 3PL Account and add the customer_account_id to the mutation; this may be why the difference isn’t visible from the 3PL.

Please let me know if you have any questions or concerns.

Best,
RayanP

okay I get it why its not showing in 3PL account, one issue is i could not understand, before the change inventory was 100, i executed inventory subtract mutation so it should reduce the inventory 5 from the available inventory, in stead looks like it changes to 5 and that too from on hand.
Can you help to understand how its working?

Hey @saif_storage,

Thanks for hanging in there!

At the time the mutation above was run, the current on hand was already 5, so then the mutation ran, thus subtracting 4 from the on-hand, leaving the product quantity as 1.

I see what you’re talking about regarding a previous inventory_subtract mutation where you subtracted 5 from the on hand and expected 95, but instead, it looks like 10 - 5 happened. I wasn’t able to find the reason as to why this occurred, but I will run it by the team.

Could you try running these mutations from the 3PL level and let me know if you’re still encountering this issue?

Please let me know if you have any questions or concerns.

Best,
RayanP

1 Like