Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hi everyone,
Hope you're well !
I am running a shop in US and Canada with 2 inventory locations (1 per country). I am using Shopify Markets to prevent people from the US to see Canada inventory and vice versa.
However, sometimes (I imagine because the market detection is IP based), it does not work well and some US folks are able to complete orders even though the US inventory is at 0. When this happens, the inventory at the US count goes below zero (or even further if it was already sitting at -1).
So I thought I would use Shopify flow as a second level barrier to automatically cancel any order that generates negative inventory level at any location taken individually on any of its line item.
I came up with this flow
However, this is not working well, as it only triggers if the sum of the inventory count at all location is negative. For example, if an order is placed, and it takes Product XYZ US inventory to -2 but Canada inventory still has 10 units of Product XYZ, it does not trigger because the Flow considers that the inventory level is still positive as it counts 8 units (sum of Canada + US).
I think there is a way to get Flow to make the check on a per-location basis, but my experience with Flow is limited, so I could not figure out how...
(I thought about modifying the default Tag out of stock products for a single location only template and inserting a GetData to grab the last 1 order within the last 1 minute and cancel, but I could not figure that either... That seemed even more complicated)
Any help would be greatly appreciated
Solved! Go to the solution
This is an accepted solution.
Hi @nguetto2,
There's been some API changes in this space lately that we're working on supporting better in Flow, but for now there is a deprecated field that might give you what you're looking for.
Looking at the order.lineItems.variant.inventoryItem.inventoryLevels.available field (available will be in the deprecated fields at the bottom) will check each location that stocks the product and check if it is < 0.
Hope that helps!
Thanks for your answer, it would be great if you could just walk me through the steps here... As they say: Give a Man a Fish, and You Feed Him for a Day. Teach a Man To Fish, and You Feed Him for a Lifetime... Especially since the answer might help others too... Unless you are pitching a sale (even if that were the case, showing your skills on this specific matter might be good marketing for you!)
This is an accepted solution.
Hi @nguetto2,
There's been some API changes in this space lately that we're working on supporting better in Flow, but for now there is a deprecated field that might give you what you're looking for.
Looking at the order.lineItems.variant.inventoryItem.inventoryLevels.available field (available will be in the deprecated fields at the bottom) will check each location that stocks the product and check if it is < 0.
Hope that helps!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024