Changing Product ( Market / Markets ) Availability Based on Metafield Value in Shopify Flow

Topic summary

A merchant wants to dynamically control product availability across different Shopify Markets based on metafield values. For example, products tagged with ‘US-SHIP’ in a metafield should only be available in the US market.

Current Limitation:
Shopify Flow doesn’t natively support changing market availability based on metafields.

Proposed Solution:

  • Create a custom metafield (e.g., product.metafields.custom.market_availability) to store market restrictions
  • Set up a Shopify Flow workflow that triggers when the metafield contains specific values
  • Use Flow’s “Send HTTP Request” action to call the Shopify Admin API (GraphQL)
  • The API request updates the product’s publishedInContext settings for specific markets

Alternative Approach:
Third-party automation apps like Mechanic or LoyaltyLion can handle metafield-based automation without custom coding.

The discussion remains open for implementation, with the merchant seeking feedback on this scalable automation approach.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

I’m trying to create a dynamic system on Shopify where the market(s) where a product can be sold is determined by a specific metafield value that I’ve set up. Essentially, I want to control which regions or markets each product is available in by utilizing custom or original metafields, so that if a product’s variant contains ‘US-SHIP,’ for instance, it should be available only in the US.

Has anyone done something similar or have any suggestions on the best way to implement this? I’m open to using automations, third-party apps, or even custom solutions, but ideally looking for an efficient and scalable way to set up market restrictions based on metafields.

Thanks in advance for your help!

2 Likes

Hi @ophi3341

It sounds like you’re trying to dynamically control product availability across different Shopify Markets using metafields, which is a smart and efficient way to manage regional restrictions. I totally get why you’d want an automated and scalable solution for this, so let’s dive into the best approach.

Understanding the Case

Shopify Flow currently doesn’t have a built-in way to directly change market availability based on metafields, but you can still achieve this with a combination of Shopify Flow, Shopify APIs, and custom automation.

Solution: Using Shopify Flow + Admin API

Since Shopify Flow allows you to trigger workflows based on metafields, you can use it to update product availability by calling the Shopify Admin API.

**Steps to Set Up:**1. Create a Metafield for Market Availability

  • In Shopify Admin, go to Settings > Custom Data > Products and define a metafield such as product.metafields.custom.market_availability.
  • Set this metafield as a single-line text or list of values, depending on how many markets you plan to handle.
  1. Set Up a Shopify Flow Automation

    • Trigger: “Product updated” (to detect metafield changes).
    • Condition: Check if the metafield contains a specific value (e.g., US-SHIP).
    • Action: Use the “Send HTTP Request” action in Shopify Flow to update the product’s market availability via the Admin API.
  2. Use Shopify Admin API to Update Product Market Availability
    You’ll need to send a GraphQL API request to update the product’s availability in different markets.

    Example API Request:

    { “product”: { “id”: “gid://shopify/Product/123456789”, “publishedInContext”: { “marketId”: “gid://shopify/Market/12345”, “published”: true } } }

    • Replace 123456789 with the actual Product ID.
    • Replace 12345 with the correct Market ID for the US.
  3. Alternative: Using a Third-Party App

    • If coding isn’t your thing, you can use apps like Mechanic or LoyaltyLion that allow custom automation based on metafields.

Final Thoughts

This setup allows your products to dynamically update availability based on metafields, making it scalable and automated. If you need extra help, just let me know asap. Thanks!

Daisy.