Publish product to specific market

Hi all,

I want to publish a product to a specific market. I ran into two problems. It feels like i’m missing some information on how this works, like i’m searching in the wrong place.

  1. When i run the query below I only see Online Store and Shop. How do I get the right PublicationID? Weird thing is that if i query the publication directly with the ID I got from chrome inspect using the admin, I see the (french) publication details?
  2. When I have the ID. How do I assign a product to that market?
query GetPublications {
  publications(first: 10) {
    edges {
      node {
        id
        name
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Can somebody point me to the right direction?

1 Like

Hi there.

Publishable content can be quite confusing, but I think you should be able to do it quite simple following this. It’s specifically made to handle publications regarding markets - I filtered the publications query.

Get MARKET publications

query publications {
    publications(first: 250, catalogType: MARKET) {
        edges {
            node {
                id
                catalog {
                    title
                }
            }
        }
    }
}

Now take the market Publication ID you need and put it into this query with the Product ID.

mutation PublishProductToMarket($productId: ID!, $publicationId: ID!) {
    publishablePublish(
        id: $productId
        input: { publicationId: $publicationId }
    ) {
        publishable {
            publishedOnPublication(publicationId: $publicationId)
        }
        userErrors {
            field
            message
        }
    }
}

Hope that helps. I managed to publish a specific product on a specific market publication this way.

2 Likes

Hi @curzey,

Thank you that worked. Indeed I was thrown off by Market / Publication. Have a good one!

2 Likes