Inventory adjustment after Order is created

Highlighted
New Member
7 0 0

Hi,

I have a unique requirement from client and need to adjust as soon as order is created.

Client is in plus account. Can we customize the checkout.liquid file? how to call the inventory api in the checkout.liquid for the adjustment?

0 Likes
Highlighted
Shopify Partner
41 5 9

The quantities of the items in the order are automatically deducted when the order is created.

Are you trying to adjust the inventory before the checkout is complete? 

0 Likes
Highlighted
New Member
7 0 0
No,

After checkout I want to do. I have access to checkout.liquid file.


0 Likes
Highlighted
Shopify Partner
41 5 9

Are you trying to adjust the inventory by a different amount than what is on the order?

0 Likes
Highlighted
New Member
7 0 0
Yes.

Problem statement is, let's say our product is single bottle of wine. But we sale them in packs (6/12 packs).

When customer buys the pack, quantity of packs is reduced. But we need to reduce the quantity of wine bottle.



We have single location implementation.


0 Likes
Highlighted
Shopify Partner
41 5 9

If I understand correctly, your store sells singles, 6 packs, and 12 packs. When a 6 pack is sold, you want it to deduct 6 singles from inventory.

This cannot be accomplished with liquid. You’ll need to use the Shopify Admin API. To use this safely, you’ll want to interact with it in a non public facing environment, like server side or in a server less function.

Alternatively, you can look for third party Inventory management software that integrates with Shopify. Basic inventory management software can handle kit/package SKUs that are made up of multiples of a single SKU.

0 Likes
Highlighted
New Member
7 0 0
Thanks a lot.

Just curious about how to use serverless solution to this? Will we need to implement webhooks on order creation?




0 Likes
Highlighted
Shopify Partner
41 5 9

Webhooks are one way to trigger a serverless function, and in this case, probably the best way to do it.

The webhook's data will contain the order ID. You could then fetch the order details using the Admin API, followed by a fetch to update the products inventory.

0 Likes