My company is using a PIM called Plytix that is able to sync all our products daily for the use case of making sweeping changes to 100+ products often. That being said, we have an “attribute” on each product that is the available inventory that comes into Shopify as a metafield. Is it possible to sync the Available inventory tracking to be equal to the metafield?
Topic summary
Goal: Sync a product metafield (from Plytix PIM) to actual inventory levels in Shopify so available stock is controlled by the metafield value.
Key clarifications and constraints:
- Inventory exists at the variant level (not product). “Available” could mean quantity, tracking, or continue-selling policy; clarify intent.
- Shopify Flow lacks a product-updated trigger and an update-inventory action. Workarounds: scheduled trigger + advanced HTTP requests to the Admin API.
Attempt and issue:
- OP used Flow to POST to /admin/api/2023-01/inventory_levels/set.json, looping over products/variants/metafields.
- Received 400 Bad Request due to sending multiple JSON objects with newlines in a single POST. Likely needs one valid JSON payload per request (iterate and send per variant), ensuring location_id, inventory_item_id, and available are correctly set.
Suggested solutions:
- Use a third-party automation app/service (e.g., Mechanic) to parse metafields and set inventory.
- Mesa app offered a ready-made workflow/template to update inventory levels from variant metafield values (screenshots provided).
New related request:
- Another user needs a composite/bundle SKU: stock of AI8-AB = AI8-A + AI8-B; orders deplete B first, then A; AB auto-updates as A/B change. They’re asking if Mesa can support this logic.
Status: No final resolution. Viable paths are third-party automation or fixing Flow to send one valid API payload per variant. Code snippets and screenshots are central to understanding.
Variants have inventory or tracking , products do not have inventory or tracking.
Every product has at least 1 default variant.
What do you mean by “Available inventory tracking”.
Do you mean the inventory QUANTITY, or the inventory TRACKING, or by “Available” the inventory_policy aka continue selling when out of stock.
Regardless you will need a third party automation app|service* to read & parse metafield data and use it to set inventory data.
Mechanic can do this but nothing exact for what the specific use case may be.
An example is the reverse of this process:
https://tasks.mechanic.dev/sync-inventory-levels-to-variant-metafields
*Currently shopify-flow cannot do this easilty as there is currently no product-updated trigger, nor an update-inventory action.
Though there is schedule trigger, the get-product-data action and the advanced send-http-request action to work with the api directly.
If you need automation services then contact me by email see contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Hey Paul, thanks for the insight and it certainly has helped. I’m currently trying to achieve this with Shopify Flow (as you hinted) via a scheduled trigger and an HTTP POST request to https://{my_store_id}.myshopify.com/admin/api/2023-01/inventory_levels/set.json. The issue I’m having is getting the inventory_id and the metafield as variables. My current body is:
{% for products_item in shop.products %}
{% for metafields_item in products_item.metafields %}
{% if metafields_item.key == 'web_available_inventory' %}
{% for variants_item in products_item.variants %}
{"location_id": {location_id_here},"inventory_item_id": variants_item.inventoryItem.id,"available":metafields_item.value}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
But the above gives a 400 error for bad request with a ton of "\n"s in the request body response.
Update: Posting the error 400 below showing that it’s properly pulling the variables for the inventory_id and metafield value. Do I need to update my HTTP POST request to include the variable in the URL rather than loop through all products during a single POST?
Current POST URL: https://{shop_name_here}.myshopify.com/admin/api/2023-01/inventory_levels/set.json
This is the body of my request:
{% for products_item in shop.products %}
{% for metafields_item in products_item.metafields %}
{% if metafields_item.key == ‘web_available_inventory’ %}
{% for variants_item in products_item.variants %}
{“location_id”: xxxx8558492,“inventory_item_id”: {{variants_item.inventoryItem.id}},“available”:{{metafields_item.value}}}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
I saw you’re beginning to work on this in flow. I’d imagine there should be a way to work out those kinks you’re hitting. If you’re interested in a 3rd party app, I should be able to build this workflow out for you with our app mesa.
I put together a workflow template for this here in case you’re interested:
https://www.getmesa.com/blog/update-inventory-levels-from-product-variant-metafield-value/
Hello Kalen, I’m looking for a solution for updating my inventory also, maybe your MESA app can help me. I need to set the stock of product SKU AI8-AB as the sum of stocks of AI8-A and AI8-B. When an order comes for AI8-AB it should reduce inventory from AI8-B until it gets to cero and then start reducing AI8-A inventory. AI8-AB also needs to update to always be the sum of A and B when this ones are reduced or increased.

