How can I restrict the Market of the Product using GraphQL

Topic summary

Goal: Automate restricting each newly added Shopify product to a single Market (e.g., Canada) via API. The poster can update Sales Channels but couldn’t find how to target Markets for specific products.

Solution provided: Use the Admin GraphQL mutation publishablePublish to publish a product to a specific Market publication. Supply the product’s gid and the Market’s publicationId.

How to find publicationId: Query publications with catalogType: MARKET, then use the MarketCatalog fields to retrieve publication { id, name } and markets { handle } to identify the Canada market’s publication.

Notes: This approach controls where a product is published by Market, not editing Market definitions themselves. Suitable for high-volume automation (10k+ products/day). The attached screenshot isn’t necessary to implement the solution.

Outcome/status: A clear API method and example were provided. Action items are to fetch the correct publicationId and call publishablePublish per product. The thread appears resolved with no outstanding questions.

Summarized with AI on December 31. AI used: gpt-5.

Hello everyone,

I have an automation programmed to add over 10,000 products to Shopify on a daily basis.

I need to restrict the market for each newly added product to only one region, for example, Canada only. Please see the attached screenshot below for clarity.

However, I am unable to find the mutation needed to accomplish this. I can update the Sales Channels of a product using the Product ID, but I cannot do the same for the Markets. Please note that I am talking about updating the Markets (to, let’s say, only Canada) for a specific Product ID, and not about adding, removing, or editing the Markets field.

This must be done through the API because it is impractical to update all the new products manually on a daily basis. Can anyone here help me out with this? Thank you.

Hey @hassanashas ,

This can be done via the api using the publishablePublish mutation.

In your mutation, you can specify the product id and the id of the market publication you want it published on.

Here’s an example of what the mutation could look like:

mutation PublishablePublish {> publishablePublish(> id: “gid://shopify/Product/8011698569238”> input: { publicationId: “gid://shopify/Publication/124654878742” }> ) {> publishable {> … on Product {> id> }> }> }> }

If you’re not sure of the publication ID of your Canada market, you can query publications to identify this. Here’s an example query you can try. I’ve included the markets handle to make it easier to identify the specific market.

query Publications {> publications(first: 10, catalogType: MARKET) {> nodes {> catalog {> … on MarketCatalog {> publication {> id> name> }> markets(first: 10) {> nodes {> handle> }> }> }> }> }> }> }

Hope that helps,

  • Kyle G.