Product variants subtract more than one unit from inventory

Product variants subtract more than one unit from inventory

wasay-a99
Shopify Partner
7 0 0

Hey All, 

I did some googling and I could not find any solution to this aside from getting a paid app.

 

I have a product with multiple variants. The only "variant" is qty of the product, so I want them to pull from the same inventory pool. 

 

Also since the variant is quantity based, 1 variant will actually be 3 units, another variant is 5 units, etc.. 

Shopify just subtracts 1 from each variant inventory. I need to subtract 3 or 5 to match how much is actually sold.

 

Is there a way to do this in Shopify Flows?

 

I saw people mentioning shopify flows doesn't easily let you adjust inventory, but this post found a way to it with HTTP requests. This is just a straight change to inventory counts irrespective of the variant ordered. So not my use case 😕

 

https://community.shopify.com/c/shopify-flow-app/how-can-i-update-product-quantity-using-shopify-flo...

 

I'm not super savvy, but if there's a way I'd appreciate someone's input.

Replies 12 (12)

paul_n
Shopify Staff
1185 144 278

I'm not sure what you are trying to do. If you could restate that a bit it might help someone provide help. There is a way using Send Admin API request to set inventory.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
wasay-a99
Shopify Partner
7 0 0

I have a product with 3 variants:

variant 1 =  1 unit of product

variant 2 = 3 units of product
variant 3 = 5 units of product

 

The issue is that no matter which variant the customer picks, shopify will subtract 1 unit from the total inventory.

Instead for variant 2, 2 units need to be subtracted from the total inventory, and 3 for variant 3.

 

Is there a way to subtract the actual quantity that gets purchased?

 

Here's an example store (not mine): https://spacegoods.com/en-int/products/rainbow-dust-coffee

There's three variants, 1 bag, 2 bags, 3 bags.

paul_n
Shopify Staff
1185 144 278

Have you looked at using the Bundles app? https://apps.shopify.com/shopify-bundles

 

It's probably technically possible using Flow, but I'm not sure how Flow would reliably know how inventory to deduct, unless that information was stored in a metafield or maybe tag.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
wasay-a99
Shopify Partner
7 0 0
Ideally I keep the product itself unchanged, I don't want to make a bundle
out of this offer.
I was hoping for some backend solution.
paul_n
Shopify Staff
1185 144 278

Avoiding bundles may be creating more work for you in the long run, so I'd give that some more thought. 

 

Assuming you want to use Flow, it's not clear how you will know that variant 2 represents 3 products. If you can figure that out, then you should be able to build the right conditions in Flow. 

 

You can set the inventory using the new "Send Admin API request" action to call this API/mutation: https://shopify.dev/docs/api/admin-graphql/2024-04/mutations/inventoryAdjustQuantities

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
wasay-a99
Shopify Partner
7 0 0
I assumed identifying qty through the sku would be sufficient.

Something like: if sku ‘productvarient2’ ordered, then reduce inventory by
3.

Do you think that’s viable?

paul_n
Shopify Staff
1185 144 278

That's not much to go on. You could check if the SKU contains "2", but any SKU could have a number in it. I think it would be better to set up a metafield that stores the quantity. Or maybe a tag with a certain prefix like "quantity:2".

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
wasay-a99
Shopify Partner
7 0 0
Product tag or metafield would both be a good way to do it.
My coding knowledge is super limited. I find the link you sent is hard to
understand.
Would you be able to help guide me on how to get this implemented in Flow?

Alternatively I was looking at the Mechanic app. They have a backend
solution for this, but paying monthly for this 1 use doesn't seem worth it
to me.
paul_n
Shopify Staff
1185 144 278

I don't think any tool is going to just work for you, because you don't have the data stored in a reliable way. So first, create a product variant metafield definition in your Admin settings (of type number) and "Pin" it so you can see it in your Admin. They set the value for the variants. Once you have that set up, you can check if the order has a variant where that number is > 1. If so, you use Send Admin API request to update the inventory. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Kalen_Jordan
Shopify Partner
526 17 77

I should be able to help you with this.

wasay-a99
Shopify Partner
7 0 0

What do you have in mind?

 

Kalen_Jordan
Shopify Partner
526 17 77

I'm thinking we can calculate the inventory level in a run code step and then an inventory update mutation. I've got a link in my footer for paid work.