Scheduling a product with GraphQL

m1mike
New Member
1 0 0

Hello,

I'm trying to update an existing product as active, available in the "Online Store" sales channel, and scheduled for a future date and time. I've reviewed the mutation for publishablePublish, but I'm not sure how to get it to work. I would appreciate a little help. Here is the "sample" code from Shopify:

 

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

 

 

The arguments are supposed to be:

Argument Description

id ( ID! ) REQUIRED

The resource to create or update publications for.

input ( [PublicationInput!]! ) REQUIRED

Specifies the input fields required to publish a resource.

 

What are ID! and [PublicationInput!]! ? How are values passed in? What are the expected formats?

I've tried various forms of a product id like "gid://shopify/Product/6047052988580" or just the number, 6047052988580.  I get errors like, "expected Name, found String" or "expected Name, found Int."

I'm having the same problem with the PublicationInput. I've tried putting in a json array of the values for publicationId and publishDate, but that is not working.

Help please!

0 Likes