We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

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

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

ophi3341
Visitor
2 0 2

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!

Best Wishes
Reply 1 (1)

DaisyVo
Shopify Partner
4469 501 598

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.
  2. 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.
  3. 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.
  4. 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.

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Avada SEO & Image Optimizer - The #1 SEO solution