FROM CACHE - en_header

Publish to all sales channels

Sachin__
Excursionist
20 2 8

Is there any way to add a product in all the sales channel using graphql muration.

Replies 2 (2)
kindahome
Excursionist
13 3 1

after all that time, is there an answer?

kindahome
Excursionist
13 3 1

after hours with chat talking with support, and nobody knows and helps, I could publish the solution...

 

Imagina that I needed to use deprecated fields because the fields that are supposed to be used, didn't work...

 

mutation publishablePublish($id: ID!, $input: [PublicationInput!]!) {
  publishablePublish(id: $id, input: $input) {
    publishable {
      availablePublicationCount
      publicationCount
      publishedOnCurrentPublication
    }
    shop {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

Call:

 

async function publishToChannelHelper(variables) {
  try {

    //COST - 37
    await getApiPoints(37);
    
    let myTesting = await axios.post('http://localhost:3060/graphql', {"query": gq.publishChannel, "variables": variables}
            ).then( async (res) => {  
			
              console.log(res.data)
              

              return res.data
      
        })

        console.log("THIS IS TESTING")
        console.log(myTesting.errors[0])
        
    return myTesting
  } catch (err) {
    throw err
  }
}