Automatically reconciling Shopify inventory for Amazon FBA orders using Shopify Flow

This Shopify Flow is designed to automatically reconcile Shopify inventory when Amazon FBA fulfills orders through Marketplace Connect. When a new order is created, the Flow checks whether the customer display name equals “FBA Order” and whether the order has not already been processed, using a guard tag to ensure idempotency. It then iterates through each line item, confirms that the item has a valid SKU, and uses Shopify’s native inventoryAdjustQuantities Admin API mutation to reduce the available inventory at the dedicated Amazon location by the quantity Amazon fulfilled. This ensures Shopify’s inventory accurately reflects stock consumed by FBA, even though Marketplace Connect itself does not adjust inventory levels inside Shopify.

Marketplace Connect handles order creation, payment capture, fulfillment, and archival, but it does not modify Shopify inventory, which would otherwise drift over time. This Flow acts as the reconciliation layer between the two systems, ensuring that each FBA order reduces Shopify inventory exactly once, with every adjustment logged as an inventory correction for auditability. The process is fully automated, scoped only to new FBA orders, and does not touch historical data. As a result, Shopify remains the system of record for inventory accuracy while Amazon remains the system of record for fulfillment execution, without requiring manual intervention or external middleware.

for reference. here is the flow. there are some details that do not show in the mutation step that are specific to the inventory location itself. if people are interested I can provide more detail.

I tried to recreate this, and everything seems to work until the “Send Admin API request,” where I get the following error:
“Exception: Mutation had errors: ‘Variable $input of type InventoryAdjustQuantitiesInput! was provided invalid value for changes.0.locationId (Expected value to not be null)’.”

This is the content of my Flow for the Configuration Mutation input:

{
“input”: {
“reason”: “correction”,
“name”: “available”,
“changes”: [
{
“delta”: {{ lineItemsForeachitem.quantity | times: -1 }},
“inventoryItemId”: “{{ lineItemsForeachitem.variant.inventoryItem.id }}”,
“locationId”: “gid://shopify/Location/XXXXXXXXXXX”
}
]
}
}

you will need to replace the “XXXXXXXXX” with the location ID you have for the location you want it to modify.

hope that helps!

Thank you, I came to the same conclusion that the mutation was missing an argument. It fixed the problem. Also, I was wondering why you added a 2 minute delay?

just to give the system a little time to resolve between sources. glad to hear you got it working!