Back to Content Management API

productPageUpdate

Updates a product page.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the product page you want to update.

  • Name
    input
    Type
    ProductPageUpdateInput!
    Description

    An object.

    • title: String
    • firstPublishedAt: DateTime
    • firstPublishedAtTimezone: String
    • description: String
    • template: String
    • sectionIds: [ID!]

Returns

  • Name
    ProductPage.*
    Type
    ProductPage
    Description

    Any requested field from the Productpage object.

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
  mutation ProductPageUpdate($id: ID!, $input: ProductPageUpdateInput!) {
    productPageUpdate(id: $id, input: $input) {
      id
      title
      handle
      description
    }
  }
`;

const variables = {
  id: 'YOUR-PAGE-ID',
  input: {
    title: 'YOUR-TITLE',
    firstPublishedAt: 'YOUR-FIRST-PUBLISHED-AT',
    firstPublishedAtTimezone: 'YOUR-FIRST-PUBLISHED-AT-TIMEZONE',
    description: 'YOUR-DESCRIPTION',
    template: 'YOUR-TEMPLATE',
    sectionIds: ['YOUR-SECTION-ID']
  }
};

const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
  "data": {
    "productPageUpdate": {
      "id": "YOUR-PAGE-ID",
      "title": "YOUR-TITLE",
      "handle": "YOUR-HANDLE",
      "description": "YOUR-DESCRIPTION"
    }
  }
}

Was this page helpful?