Automate Mirakl 1P Stock Status with Inventory Changes
This Flow automatically updates your Mirakl `has_1p_stock` product metafield to reflect actual inventory availability, ensuring accurate marketplace listings.
The Problem
Manually updating a 'has 1P stock' flag for every product variant, especially when syncing with marketplaces like Mirakl, is a massive time sink and prone to errors. Incorrect stock status can lead to cancelled orders, poor customer experience, and potential penalties, costing you valuable time and revenue.
What This Automation Solves
This Shopify Flow instantly reacts to `Product variant inventory quantity changed` events. It intelligently checks if the inventory is available (and not from a marketplace fulfillment location) and whether the `mirakl.has_1p_stock` metafield needs an update. If stock becomes available, it sets `has_1p_stock` to `true`; if depleted, it sets it to `false`, ensuring your Mirakl integration always receives the correct, real-time status.
When to Use This Automation
- You list products on Mirakl and need to signal direct-ship inventory (1P stock).
- You want to prevent overselling or underselling 1P stock on Mirakl due to out-of-sync data.
- You manage a large catalog where manual metafield updates are impossible to maintain.
Workflow
Trigger
Step 1This workflow starts when the inventory level changes for a specific product variant
Condition
Step 2Location name does not start with MKP_ AND Inventory levels available is greater than 0
Condition
Step 3Has1 p stock value is equal to false OR Has1 p stock value does not exist.
Action
Step 4Add this metafield to the product variant: mirakl.has_1p_stock
Condition
Step 5Has1 p stock value is equal to true OR Has1 p stock value does not exist.
Action
Step 6Add this metafield to the product variant: mirakl.has_1p_stock
Step-by-Step Setup
- 1
**Set Trigger and Initial Condition:** Start a new Flow with the 'Product variant inventory quantity changed' trigger. Add a `Condition` block where `Location name` does `not start with` "MKP_" (to exclude marketplace fulfillment locations).
- 2
**Configure In-Stock Branch:** Inside the location condition, add an 'If' branch. Set the condition as `Inventory levels available` is `greater than 0`. Within this 'If' branch, add a nested `Condition` for `mirakl.has_1p_stock` being `equal to false` OR `does not exist`. Finally, add an `Update product variant metafield` action to set `mirakl.has_1p_stock` to `true` (Boolean type).
- 3
**Configure Out-of-Stock Branch:** After the 'If' branch from the previous step, click to "Add 'Else' branch". Within this 'Else' branch, add a `Condition` for `mirakl.has_1p_stock` being `equal to true` OR `does not exist`. Add an `Update product variant metafield` action to set `mirakl.has_1p_stock` to `false` (Boolean type).
Related Questions
- What is the `mirakl.has_1p_stock` metafield used for?
- This metafield signals to Mirakl (or a Mirakl integration) whether the stock for a particular product variant is directly managed and fulfilled by your store (1st party), rather than being dropshipped or fulfilled by a 3rd party.
- Why is it important to filter out locations starting with 'MKP_'?
- Many marketplace integrations use special location names (like "MKP_Amazon") to track inventory reserved for or fulfilled by those marketplaces. Excluding these ensures your 1P stock flag only reflects inventory available for your direct fulfillment.
- What happens if the `mirakl.has_1p_stock` metafield doesn't exist yet?
- The Flow is designed to handle this. If the metafield doesn't exist, the conditions 'does not exist' will evaluate to true, allowing the Flow to create the metafield and set its initial `true` or `false` value based on the current inventory level.
- Can this Flow handle multiple fulfillment locations for 1P stock?
- Yes, as long as the locations you consider 1P stock do *not* start with "MKP_", this Flow will correctly sum the inventory from all relevant locations to determine the overall 1P stock availability before updating the metafield.
Recommended Tools & Apps
Launch this automation
Open Shopify Flow and use this page as your setup blueprint.
Merchant Insight
Always test your Flow thoroughly after creation, especially if you have complex inventory setups or multiple fulfillment locations. Run a few test scenarios by manually adjusting stock for a variant (e.g., set to 1, then to 0) and check the
Related Automations
How to Get Email Alerts for Low Product Variant Inventory
Automate internal email notifications instantly when any product variant's inventory dips below your critical threshold, ensuring you never miss a restock opportunity.
How to Automatically Hide Out-of-Stock Products on Shopify
Automatically unpublish products from your online store when inventory hits zero, and republish them when restocked, ensuring customers always see available items.
Automatically Republish Back-in-Stock Products
Automatically make products visible on your online store the moment they come back in stock, ensuring customers can purchase without delay.