How to Sync MarketMan Inventory with Your Online Store
Keep your restaurant's online ordering inventory in sync with MarketMan.
What This Integration Does
Selling something online that's not actually on the shelf damages trust and forces awkward refunds. This workflow mirrors MarketMan inventory counts into your online store (Shopify in most cases) so menu items, retail goods, and meal kits go unavailable the moment back-of-house counts hit zero. It also restocks them automatically when fresh inventory is received.
The workflow runs on a tight schedule (every 5 to 15 minutes), reads current counts from MarketMan, joins them against a mapping of MarketMan item IDs to Shopify variant IDs, and pushes inventory adjustments to Shopify. It is idempotent: re-running it with the same counts simply re-confirms what's there. Mappings live outside the workflow (in a CSV or MongoDB collection) so non-developers can add new SKUs.
Prerequisites
- A MarketMan connection with permission to read inventory counts.
- A Shopify connection with
write_inventoryscope. The store must have inventory tracking enabled on the variants you want to sync. - A mapping table linking MarketMan
itemIdto ShopifyvariantIdandinventoryItemId. Stored in MongoDB or a CSV the workflow can read. - A primary location ID in Shopify (returned by
get-shop) so adjustments target the right warehouse or store.
Step 1: Schedule Trigger
Drop a Trigger node and set it to Schedule. Every 15 minutes is a good default; tighten to 5 minutes if you sell perishables that move fast. Anything sub-5-minute will start consuming MarketMan API quota for marginal benefit.
Step 2: Read MarketMan Counts
Add a Connector node pointing at marketman. If your connection requires manual token auth, call get-token first. Then call get-inventory-counts to retrieve the current on-hand quantity for every tracked item. Store as {{ counts }}.
Step 3: Load the Item-to-Variant Mapping
Add a Connector node pointing at mongodb and call find-documents on a inventory_map collection. Each document looks like:
{
"marketmanItemId": "ITEM-1234",
"shopifyVariantId": "gid://shopify/ProductVariant/9876",
"shopifyInventoryItemId": "12345678",
"active": true
}
If you prefer a flat file, swap in the csv connector with parse and to-json. Filter to active: true so retired items don't fight the sync.
Step 4: Transform - Pair Counts with Variants
Add a Transform node that joins counts against the mapping on marketmanItemId and emits one row per Shopify variant:
[
{ "inventoryItemId": "12345678", "available": 17 },
{ "inventoryItemId": "23456789", "available": 0 }
]
This is also where you apply business rules - for example, clamping negative counts to zero, or holding back a safety buffer so the online channel doesn't sell the very last unit.
Step 5: Push Adjustments to Shopify
Wrap a Loop node around the joined list. Inside, add a Connector node for shopify and pick the adjust-inventory tool. Pass:
- inventoryItemId:
{{ row.inventoryItemId }} - locationId: your primary location
- available:
{{ row.available }}
Shopify's adjust-inventory call is a set, not a delta - send the final desired count and the platform reconciles. This is why re-running the workflow is safe.
Step 6: Handle Failures Gracefully
Wrap the loop in error handling: if a single variant fails (deleted in Shopify, mapping out of date), log it and continue rather than aborting the whole sync. Add a Condition node after the loop that fires a slack send-message if the failure count is non-zero, with the list of items to fix.
Tips
- Batch your Shopify calls - for large catalogs, use
raw-graphqlwithinventoryBulkAdjustQuantityAtLocationto update many variants in one request. Far fewer API hits than a tight loop. - Use a safety buffer - subtract 1 or 2 from
availableon high-velocity items so a count drift doesn't oversell the last portion. Configure per-item in the mapping doc. - Sync metadata separately - prices, descriptions, and product photos don't need to run every 15 minutes. Keep this workflow narrow to counts and run a slower workflow for product details.
Common Pitfalls
- Wrong location - if your Shopify has multiple locations, the adjustment must target the one your online channel actually fulfills from. Verify with
get-shopand lock the ID into a workflow variable. - Inventory tracking off - Shopify silently rejects adjustments on variants where tracking isn't enabled. Audit the catalog and turn on tracking for every variant in the mapping.
- Drift between counts and reality - MarketMan only knows what's been received and counted. Walk-in shrinkage, comps, and staff meals all drift the count down. Pair this sync with a daily reconciliation routine.
Testing
Set up a single test variant in Shopify and one corresponding item in MarketMan. Manually change the MarketMan count and run the workflow once. Confirm the Shopify inventory adjusts correctly, including at zero (the variant should show as sold out). Then bump frequency up and watch a few cycles before pointing it at the whole catalog.