---
title: discountNode - GraphQL Admin
description: Returns a `DiscountNode` resource by ID.
api_version: 2026-10
source_url:
  html: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/discountNode'
  md: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/discountNode.md'
api_name: admin
api_type: graphql
type: query
---

# discount​Node

query

Returns a `DiscountNode` resource by ID.

## Arguments

* id

  [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)

  required

  The ID of the `DiscountNode` to return.

***

## Possible returns

* Discount​Node

  [Discount​Node](https://shopify.dev/docs/api/admin-graphql/latest/objects/DiscountNode)

  The `DiscountNode` object enables you to manage [discounts](https://help.shopify.com/manual/discounts), which are applied at checkout or on a cart.

  Discounts are a way for merchants to promote sales and special offers, or as customer loyalty rewards. Discounts can apply to [orders, products, or shipping](https://shopify.dev/docs/apps/build/discounts#discount-classes), and can be either automatic or code-based. For example, you can offer customers a buy X get Y discount that's automatically applied when purchases meet specific criteria. Or, you can offer discounts where customers have to enter a code to redeem an amount off discount on products, variants, or collections in a store.

  Learn more about working with [Shopify's discount model](https://shopify.dev/docs/apps/build/discounts), including related mutations, limitations, and considerations.

  * discount

    [Discount!](https://shopify.dev/docs/api/admin-graphql/latest/unions/Discount)

    non-null

    A discount that's applied at checkout or on cart.

    Discounts can be [automatic or code-based](https://shopify.dev/docs/apps/build/discounts#discount-methods).

  * events

    [Event​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/EventConnection)

    non-null

    The paginated list of events associated with the host subject.

    * after

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      ### Arguments

      The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * before

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * first

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * last

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * query

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).

      * * action

          string

        * comments

          boolean

        * created\_at

          time

        * id

          id

        * subject\_type

          string

        - The action that occured.

        - Example:

          * `action:create`

          Whether or not to include [comment-events](https://shopify.dev/api/admin-graphql/latest/objects/CommentEvent) in your search, passing `false` will exclude comment-events, any other value will include comment-events.

        - Example:

          * `false`
          * `true`

          Filter by the date and time when the event occurred. Event data is retained for 1 year.

        - Example:

          * `created_at:>2025-10-21`
          * `created_at:<now`

          Filter by `id` range.

        - Example:

          * `id:1234`
          * `id:>=1234`
          * `id:<=1234`

          The resource type affected by this event. See [EventSubjectType](https://shopify.dev/api/admin-graphql/latest/enums/EventSubjectType) for possible values.

          Example:

          * `PRODUCT_VARIANT`
          * `PRODUCT`
          * `COLLECTION`

    * reverse

      [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    * sort​Key

      [Event​Sort​Keys](https://shopify.dev/docs/api/admin-graphql/latest/enums/EventSortKeys)

      Default:ID

      Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).

    ***

  * id

    [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)

    non-null

    A globally-unique ID.

  * metafield

    [Metafield](https://shopify.dev/docs/api/admin-graphql/latest/objects/Metafield)

    A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information.

    * key

      [String!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      required

      ### Arguments

      The key for the metafield.

    * namespace

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      The container the metafield belongs to. If omitted, the app-reserved namespace will be used.

    ***

  * metafields

    [Metafield​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/MetafieldConnection)

    non-null

    A list of [custom fields](https://shopify.dev/docs/apps/build/custom-data) that a merchant associates with a Shopify resource.

    * after

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      ### Arguments

      The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * before

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * first

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * keys

      [\[String!\]](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      List of keys of metafields in the format `namespace.key`, will be returned in the same format.

    * last

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * namespace

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      The metafield namespace to filter by. If omitted, all metafields are returned.

    * reverse

      [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    ***

  * metafield​Definitions

    [Metafield​Definition​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/MetafieldDefinitionConnection)

    non-nullDeprecated

    * after

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      ### Arguments

      The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * before

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).

    * first

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * last

      [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int)

      The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).

    * namespace

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      Filter metafield definitions by namespace.

    * pinned​Status

      [Metafield​Definition​Pinned​Status](https://shopify.dev/docs/api/admin-graphql/latest/enums/MetafieldDefinitionPinnedStatus)

      Default:ANY

      Filter by the definition's pinned status.

    * query

      [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String)

      A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).

      * * default

          string

        * created\_at

          time

        * id

          id

        * key

          string

        * namespace

          string

        * owner\_type

          string

        * type

          string

        * updated\_at

          time

        - Filter by a case-insensitive search of multiple fields in a document.

        - Example:

          * `query=Bob Norman`
          * `query=title:green hoodie`

          Filter by the date and time when the metafield definition was created.

        - Example:

          * `created_at:>'2020-10-21T23:39:20Z'`
          * `created_at:<now`
          * `created_at:<=2024`

          Filter by `id` range.

        - Example:

          * `id:1234`
          * `id:>=1234`
          * `id:<=1234`

          Filter by the metafield definition [`key`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-key) field.

        - Example:

          * `key:some-key`

          Filter by the metafield definition [`namespace`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-namespace) field.

        - Example:

          * `namespace:some-namespace`

          Filter by the metafield definition [`ownerType`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-ownertype) field.

        - Example:

          * `owner_type:PRODUCT`

          Filter by the metafield definition [`type`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-type) field.

        - Example:

          * `type:single_line_text_field`

          Filter by the date and time when the metafield definition was last updated.

          Example:

          * `updated_at:>'2020-10-21T23:39:20Z'`
          * `updated_at:<now`
          * `updated_at:<=2024`

    * reverse

      [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean)

      Default:false

      Reverse the order of the underlying list.

    * sort​Key

      [Metafield​Definition​Sort​Keys](https://shopify.dev/docs/api/admin-graphql/latest/enums/MetafieldDefinitionSortKeys)

      Default:ID

      Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).

    ***

***

## Examples

* ### Continue rollout discovery separately from treatment changes

  #### Description

  Continue the outer rollout connection using \`rollouts.pageInfo.endCursor\` as \`rolloutsAfter\`. Don't pass a treatment's changes cursor here: each connection has its own pagination state. Newly discovered treatments start without a changes cursor. Continue any unfinished earlier treatments separately through their Node IDs, using their own saved cursors and unchanged query filters and directions.

  #### Query

  ```graphql
  query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          rollouts(first: 1, after: $rolloutsAfter) {
            nodes {
              id
              treatments {
                id
                changes(first: $first, query: $changeQuery, reverse: $reverse) {
                  nodes {
                    id
                    __typename
                  }
                  pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true,
    "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { rollouts(first: 1, after: $rolloutsAfter) { nodes { id treatments { id changes(first: $first, query: $changeQuery, reverse: $reverse) { nodes { id __typename } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } } } pageInfo { hasNextPage endCursor } } } } } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151",
      "first": 1,
      "changeQuery": "type:RolloutDiscountActivateChange",
      "reverse": true,
      "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            rollouts(first: 1, after: $rolloutsAfter) {
              nodes {
                id
                treatments {
                  id
                  changes(first: $first, query: $changeQuery, reverse: $reverse) {
                    nodes {
                      id
                      __typename
                    }
                    pageInfo {
                      hasNextPage
                      hasPreviousPage
                      startCursor
                      endCursor
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
                endCursor
              }
            }
          }
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true,
          "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            rollouts(first: 1, after: $rolloutsAfter) {
              nodes {
                id
                treatments {
                  id
                  changes(first: $first, query: $changeQuery, reverse: $reverse) {
                    nodes {
                      id
                      __typename
                    }
                    pageInfo {
                      hasNextPage
                      hasPreviousPage
                      startCursor
                      endCursor
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
                endCursor
              }
            }
          }
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true,
    "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              rollouts(first: 1, after: $rolloutsAfter) {
                nodes {
                  id
                  treatments {
                    id
                    changes(first: $first, query: $changeQuery, reverse: $reverse) {
                      nodes {
                        id
                        __typename
                      }
                      pageInfo {
                        hasNextPage
                        hasPreviousPage
                        startCursor
                        endCursor
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                  endCursor
                }
              }
            }
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true,
          "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          rollouts(first: 1, after: $rolloutsAfter) {
            nodes {
              id
              treatments {
                id
                changes(first: $first, query: $changeQuery, reverse: $reverse) {
                  nodes {
                    id
                    __typename
                  }
                  pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true,
    "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                rollouts(first: 1, after: $rolloutsAfter) {
                  nodes {
                    id
                    treatments {
                      id
                      changes(first: $first, query: $changeQuery, reverse: $reverse) {
                        nodes {
                          id
                          __typename
                        }
                        pageInfo {
                          hasNextPage
                          hasPreviousPage
                          startCursor
                          endCursor
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                    endCursor
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true,
          "rolloutsAfter": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI0LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNCJ9"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/1789387200000025",
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/1789387200000033",
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/9bf114894e87e680afb332bfbf80c384d919eaedb2f692066805918828af3b78",
                        "__typename": "RolloutDiscountActivateChange"
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": false,
                      "hasPreviousPage": false,
                      "startCursor": "WzEsImY0M2FhOTA5MTZlMjcwZTc0MGFjZmZmM2JlNjQ3ZTgzMGM1NzIzYTU2MGJkNmY2YTUxMTBkODZhM2M3NzBmNzIiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsIjliZjExNDg5NGU4N2U2ODBhZmIzMzJiZmJmODBjMzg0ZDkxOWVhZWRiMmY2OTIwNjY4MDU5MTg4MjhhZjNiNzgiXQ",
                      "endCursor": "WzEsImY0M2FhOTA5MTZlMjcwZTc0MGFjZmZmM2JlNjQ3ZTgzMGM1NzIzYTU2MGJkNmY2YTUxMTBkODZhM2M3NzBmNzIiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsIjliZjExNDg5NGU4N2U2ODBhZmIzMzJiZmJmODBjMzg0ZDkxOWVhZWRiMmY2OTIwNjY4MDU5MTg4MjhhZjNiNzgiXQ"
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "endCursor": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDI1LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDAyNSJ9"
          }
        }
      }
    }
  }
  ```

* ### Discover independent treatment change cursors

  #### Description

  Start at a discount to discover its rollouts and the first page of each treatment's changes. Your app needs \`read\_discounts\` and \`read\_rollouts\`. This public graph is unavailable before API version 2026-10. This example requests one change per treatment so that the independent page boundaries are visible. Store each treatment ID with its own changes end cursor, query filter, and reverse value. The empty baseline has no changes and \`hasNextPage: false\`; skip it rather than borrowing another treatment's cursor. For each treatment with \`hasNextPage: true\`, use \`node(id: treatmentId)\` and select \`RolloutTreatment.changes\` with that treatment's cursor as \`after\`, keeping \`changeQuery\` and \`reverse\` unchanged. Repeat until its own \`hasNextPage\` is false. Treatment order isn't an identifier. Key continuation state by treatment ID, not by its position in the list. The outer \`rollouts.pageInfo\` is independent: pass that cursor only to \`Discount.rollouts(after:)\` to discover more rollouts.

  #### Query

  ```graphql
  query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          rollouts(first: 1, after: $rolloutsAfter) {
            nodes {
              id
              treatments {
                id
                changes(first: $first, query: $changeQuery, reverse: $reverse) {
                  nodes {
                    id
                    __typename
                  }
                  pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { rollouts(first: 1, after: $rolloutsAfter) { nodes { id treatments { id changes(first: $first, query: $changeQuery, reverse: $reverse) { nodes { id __typename } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } } } pageInfo { hasNextPage endCursor } } } } } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151",
      "first": 1,
      "changeQuery": "type:RolloutDiscountActivateChange",
      "reverse": true
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            rollouts(first: 1, after: $rolloutsAfter) {
              nodes {
                id
                treatments {
                  id
                  changes(first: $first, query: $changeQuery, reverse: $reverse) {
                    nodes {
                      id
                      __typename
                    }
                    pageInfo {
                      hasNextPage
                      hasPreviousPage
                      startCursor
                      endCursor
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
                endCursor
              }
            }
          }
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            rollouts(first: 1, after: $rolloutsAfter) {
              nodes {
                id
                treatments {
                  id
                  changes(first: $first, query: $changeQuery, reverse: $reverse) {
                    nodes {
                      id
                      __typename
                    }
                    pageInfo {
                      hasNextPage
                      hasPreviousPage
                      startCursor
                      endCursor
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
                endCursor
              }
            }
          }
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              rollouts(first: 1, after: $rolloutsAfter) {
                nodes {
                  id
                  treatments {
                    id
                    changes(first: $first, query: $changeQuery, reverse: $reverse) {
                      nodes {
                        id
                        __typename
                      }
                      pageInfo {
                        hasNextPage
                        hasPreviousPage
                        startCursor
                        endCursor
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                  endCursor
                }
              }
            }
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          rollouts(first: 1, after: $rolloutsAfter) {
            nodes {
              id
              treatments {
                id
                changes(first: $first, query: $changeQuery, reverse: $reverse) {
                  nodes {
                    id
                    __typename
                  }
                  pageInfo {
                    hasNextPage
                    hasPreviousPage
                    startCursor
                    endCursor
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
              endCursor
            }
          }
        }
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151",
    "first": 1,
    "changeQuery": "type:RolloutDiscountActivateChange",
    "reverse": true
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscoverTreatmentChanges($id: ID!, $rolloutsAfter: String, $first: Int!, $changeQuery: String!, $reverse: Boolean!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                rollouts(first: 1, after: $rolloutsAfter) {
                  nodes {
                    id
                    treatments {
                      id
                      changes(first: $first, query: $changeQuery, reverse: $reverse) {
                        nodes {
                          id
                          __typename
                        }
                        pageInfo {
                          hasNextPage
                          hasPreviousPage
                          startCursor
                          endCursor
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                    endCursor
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "first": 1,
          "changeQuery": "type:RolloutDiscountActivateChange",
          "reverse": true
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/1789387200000075",
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/1789387200000100",
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/c40b9313555f1160d5dcba2e5ae35aa537e251cc0d0b78c0cd06933c8d4d38c7",
                        "__typename": "RolloutDiscountActivateChange"
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": true,
                      "hasPreviousPage": false,
                      "startCursor": "WzEsIjM5YTgyOGM4N2Q4YzBhYWE3NWFiMDA2ZGQ5MGNjYTUzMGYxODc3ODQ5MGYyYTg0YjUwMmEwMmIxMDJlZTkzNzgiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsImM0MGI5MzEzNTU1ZjExNjBkNWRjYmEyZTVhZTM1YWE1MzdlMjUxY2MwZDBiNzhjMGNkMDY5MzNjOGQ0ZDM4YzciXQ",
                      "endCursor": "WzEsIjM5YTgyOGM4N2Q4YzBhYWE3NWFiMDA2ZGQ5MGNjYTUzMGYxODc3ODQ5MGYyYTg0YjUwMmEwMmIxMDJlZTkzNzgiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsImM0MGI5MzEzNTU1ZjExNjBkNWRjYmEyZTVhZTM1YWE1MzdlMjUxY2MwZDBiNzhjMGNkMDY5MzNjOGQ0ZDM4YzciXQ"
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/1789387200000102",
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/6c3df9267ce792cf56ae487ad320d47a4f5b1ae5e4964cb79cecb28b0fb9d0b2",
                        "__typename": "RolloutDiscountActivateChange"
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": true,
                      "hasPreviousPage": false,
                      "startCursor": "WzEsIjFjMjNjNDkzNTZhOTRlNzBiZDg4NjQ4ZDVkMjk3YjRhOTRlYmZkNGVlZmIxMjkwMWI3YTM5YmQ4MzhhZmE3ZDEiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsIjZjM2RmOTI2N2NlNzkyY2Y1NmFlNDg3YWQzMjBkNDdhNGY1YjFhZTVlNDk2NGNiNzljZWNiMjhiMGZiOWQwYjIiXQ",
                      "endCursor": "WzEsIjFjMjNjNDkzNTZhOTRlNzBiZDg4NjQ4ZDVkMjk3YjRhOTRlYmZkNGVlZmIxMjkwMWI3YTM5YmQ4MzhhZmE3ZDEiLCIyMDI2LTExLTI4VDAwOjAwOjAwLjAwMDAwMDAwMFoiLDAsIjZjM2RmOTI2N2NlNzkyY2Y1NmFlNDg3YWQzMjBkNDdhNGY1YjFhZTVlNDk2NGNiNzljZWNiMjhiMGZiOWQwYjIiXQ"
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/1789387200000103",
                  "changes": {
                    "nodes": [],
                    "pageInfo": {
                      "hasNextPage": false,
                      "hasPreviousPage": false,
                      "startCursor": null,
                      "endCursor": null
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": true,
            "endCursor": "eyJsYXN0X2lkIjoxNzg5Mzg3MjAwMDAwMDc1LCJsYXN0X3ZhbHVlIjoiMTc4OTM4NzIwMDAwMDA3NSJ9"
          }
        }
      }
    }
  }
  ```

* ### Filter rollout changes by operation type

  #### Description

  Use \`type:\` with an exact, case-sensitive concrete typename to return only discount expiration changes. An inline fragment selects fields; it doesn't filter the changes connection. This query starts with the sale discount but returns the sibling clearance discount's expiration. Your app needs both \`read\_discounts\` and \`read\_rollouts\` access scopes.

  #### Query

  ```graphql
  query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            nodes {
              id
              name
              status
              treatments {
                id
                split
                changes(first: 10, query: $changeQuery) {
                  nodes {
                    id
                    __typename
                    ... on RolloutDiscountChange {
                      discount {
                        id
                        discount {
                          ... on DiscountAutomaticBasic {
                            title
                          }
                          ... on DiscountCodeBasic {
                            title
                          }
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "type:RolloutDiscountExpireChange"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { title rollouts(first: 10) { nodes { id name status treatments { id split changes(first: 10, query: $changeQuery) { nodes { id __typename ... on RolloutDiscountChange { discount { id discount { ... on DiscountAutomaticBasic { title } ... on DiscountCodeBasic { title } } } } } pageInfo { hasNextPage } } } } pageInfo { hasNextPage } } } } } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151",
      "changeQuery": "type:RolloutDiscountExpireChange"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              nodes {
                id
                name
                status
                treatments {
                  id
                  split
                  changes(first: 10, query: $changeQuery) {
                    nodes {
                      id
                      __typename
                      ... on RolloutDiscountChange {
                        discount {
                          id
                          discount {
                            ... on DiscountAutomaticBasic {
                              title
                            }
                            ... on DiscountCodeBasic {
                              title
                            }
                          }
                        }
                      }
                    }
                    pageInfo {
                      hasNextPage
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "type:RolloutDiscountExpireChange"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              nodes {
                id
                name
                status
                treatments {
                  id
                  split
                  changes(first: 10, query: $changeQuery) {
                    nodes {
                      id
                      __typename
                      ... on RolloutDiscountChange {
                        discount {
                          id
                          discount {
                            ... on DiscountAutomaticBasic {
                              title
                            }
                            ... on DiscountCodeBasic {
                              title
                            }
                          }
                        }
                      }
                    }
                    pageInfo {
                      hasNextPage
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "type:RolloutDiscountExpireChange"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              title
              rollouts(first: 10) {
                nodes {
                  id
                  name
                  status
                  treatments {
                    id
                    split
                    changes(first: 10, query: $changeQuery) {
                      nodes {
                        id
                        __typename
                        ... on RolloutDiscountChange {
                          discount {
                            id
                            discount {
                              ... on DiscountAutomaticBasic {
                                title
                              }
                              ... on DiscountCodeBasic {
                                title
                              }
                            }
                          }
                        }
                      }
                      pageInfo {
                        hasNextPage
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                }
              }
            }
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "type:RolloutDiscountExpireChange"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            nodes {
              id
              name
              status
              treatments {
                id
                split
                changes(first: 10, query: $changeQuery) {
                  nodes {
                    id
                    __typename
                    ... on RolloutDiscountChange {
                      discount {
                        id
                        discount {
                          ... on DiscountAutomaticBasic {
                            title
                          }
                          ... on DiscountCodeBasic {
                            title
                          }
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "type:RolloutDiscountExpireChange"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query FilterDiscountRolloutChanges($id: ID!, $changeQuery: String!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                title
                rollouts(first: 10) {
                  nodes {
                    id
                    name
                    status
                    treatments {
                      id
                      split
                      changes(first: 10, query: $changeQuery) {
                        nodes {
                          id
                          __typename
                          ... on RolloutDiscountChange {
                            discount {
                              id
                              discount {
                                ... on DiscountAutomaticBasic {
                                  title
                                }
                                ... on DiscountCodeBasic {
                                  title
                                }
                              }
                            }
                          }
                        }
                        pageInfo {
                          hasNextPage
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "type:RolloutDiscountExpireChange"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "title": "Black Friday discount",
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/532060658",
              "name": "Black Friday offer changeover",
              "status": "ACTIVE",
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/522314081",
                  "split": 50,
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountExpireChange/c2f0dd9c068a6dba4866e563632bc485070d427fd72568094e761b30fa639467",
                        "__typename": "RolloutDiscountExpireChange",
                        "discount": {
                          "id": "gid://shopify/DiscountCodeNode/672017907",
                          "discount": {
                            "title": "Clearance discount"
                          }
                        }
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/755492298",
                  "split": 50,
                  "changes": {
                    "nodes": [],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": false
          }
        }
      }
    }
  }
  ```

* ### Identify a rollout discount to advertise

  #### Description

  \`trafficAllocation: 100\` configures full traffic; \`effectiveTrafficAllocation: 100\` confirms competing rollouts do not reduce it. With an \`ACTIVE\` rollout, a \`split: 100\` treatment, and a matching \`RolloutDiscountActivateChange\`, the client can advertise the discount to its full eligible audience. The discount shows \`EXPIRED\` because its end date passed. The treatment still activates it for its buyers. Check every changes page for the activation. Effective allocation describes new buyer assignments, not exposure or guaranteed redemption. Normal discount conditions still apply. Recheck the rollout before advertising. Your app needs both \`read\_discounts\` and \`read\_rollouts\` access scopes.

  #### Query

  ```graphql
  query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountAdvertisingRollouts
          }
        }
        ... on DiscountCodeBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountAdvertisingRollouts
          }
        }
      }
    }
  }

  fragment DiscountAdvertisingRollouts on RolloutConnection {
    nodes {
      id
      name
      status
      trafficAllocation
      effectiveTrafficAllocation
      treatments {
        id
        split
        changes(first: 10, query: $changeQuery) {
          nodes {
            id
            __typename
            ... on RolloutDiscountChange {
              discount {
                id
                discount {
                  ... on DiscountAutomaticBasic {
                    title
                  }
                  ... on DiscountCodeBasic {
                    title
                  }
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { title status startsAt endsAt rollouts(first: 10) { ...DiscountAdvertisingRollouts } } ... on DiscountCodeBasic { title status startsAt endsAt rollouts(first: 10) { ...DiscountAdvertisingRollouts } } } } } fragment DiscountAdvertisingRollouts on RolloutConnection { nodes { id name status trafficAllocation effectiveTrafficAllocation treatments { id split changes(first: 10, query: $changeQuery) { nodes { id __typename ... on RolloutDiscountChange { discount { id discount { ... on DiscountAutomaticBasic { title } ... on DiscountCodeBasic { title } } } } } pageInfo { hasNextPage } } } } pageInfo { hasNextPage } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151",
      "changeQuery": "discount_id:'\''gid://shopify/DiscountNode/299501151'\''"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountAdvertisingRollouts
            }
          }
          ... on DiscountCodeBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountAdvertisingRollouts
            }
          }
        }
      }
    }
    
    fragment DiscountAdvertisingRollouts on RolloutConnection {
      nodes {
        id
        name
        status
        trafficAllocation
        effectiveTrafficAllocation
        treatments {
          id
          split
          changes(first: 10, query: $changeQuery) {
            nodes {
              id
              __typename
              ... on RolloutDiscountChange {
                discount {
                  id
                  discount {
                    ... on DiscountAutomaticBasic {
                      title
                    }
                    ... on DiscountCodeBasic {
                      title
                    }
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
      pageInfo {
        hasNextPage
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountAdvertisingRollouts
            }
          }
          ... on DiscountCodeBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountAdvertisingRollouts
            }
          }
        }
      }
    }
    
    fragment DiscountAdvertisingRollouts on RolloutConnection {
      nodes {
        id
        name
        status
        trafficAllocation
        effectiveTrafficAllocation
        treatments {
          id
          split
          changes(first: 10, query: $changeQuery) {
            nodes {
              id
              __typename
              ... on RolloutDiscountChange {
                discount {
                  id
                  discount {
                    ... on DiscountAutomaticBasic {
                      title
                    }
                    ... on DiscountCodeBasic {
                      title
                    }
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
      pageInfo {
        hasNextPage
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              title
              status
              startsAt
              endsAt
              rollouts(first: 10) {
                ...DiscountAdvertisingRollouts
              }
            }
            ... on DiscountCodeBasic {
              title
              status
              startsAt
              endsAt
              rollouts(first: 10) {
                ...DiscountAdvertisingRollouts
              }
            }
          }
        }
      }
      
      fragment DiscountAdvertisingRollouts on RolloutConnection {
        nodes {
          id
          name
          status
          trafficAllocation
          effectiveTrafficAllocation
          treatments {
            id
            split
            changes(first: 10, query: $changeQuery) {
              nodes {
                id
                __typename
                ... on RolloutDiscountChange {
                  discount {
                    id
                    discount {
                      ... on DiscountAutomaticBasic {
                        title
                      }
                      ... on DiscountCodeBasic {
                        title
                      }
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
        pageInfo {
          hasNextPage
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountAdvertisingRollouts
          }
        }
        ... on DiscountCodeBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountAdvertisingRollouts
          }
        }
      }
    }
  }

  fragment DiscountAdvertisingRollouts on RolloutConnection {
    nodes {
      id
      name
      status
      trafficAllocation
      effectiveTrafficAllocation
      treatments {
        id
        split
        changes(first: 10, query: $changeQuery) {
          nodes {
            id
            __typename
            ... on RolloutDiscountChange {
              discount {
                id
                discount {
                  ... on DiscountAutomaticBasic {
                    title
                  }
                  ... on DiscountCodeBasic {
                    title
                  }
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscountRolloutAdvertising($id: ID!, $changeQuery: String!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                title
                status
                startsAt
                endsAt
                rollouts(first: 10) {
                  ...DiscountAdvertisingRollouts
                }
              }
              ... on DiscountCodeBasic {
                title
                status
                startsAt
                endsAt
                rollouts(first: 10) {
                  ...DiscountAdvertisingRollouts
                }
              }
            }
          }
        }
        
        fragment DiscountAdvertisingRollouts on RolloutConnection {
          nodes {
            id
            name
            status
            trafficAllocation
            effectiveTrafficAllocation
            treatments {
              id
              split
              changes(first: 10, query: $changeQuery) {
                nodes {
                  id
                  __typename
                  ... on RolloutDiscountChange {
                    discount {
                      id
                      discount {
                        ... on DiscountAutomaticBasic {
                          title
                        }
                        ... on DiscountCodeBasic {
                          title
                        }
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "title": "Black Friday discount",
        "status": "EXPIRED",
        "startsAt": "2026-01-01T00:00:00Z",
        "endsAt": "2026-01-02T00:00:00Z",
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/532060658",
              "name": "Black Friday offer changeover",
              "status": "ACTIVE",
              "trafficAllocation": 100,
              "effectiveTrafficAllocation": 100,
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/522314081",
                  "split": 100,
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/19562284969ac8973c308a5159bf122bb6cc5966282d620bfbf81e7029f1e686",
                        "__typename": "RolloutDiscountActivateChange",
                        "discount": {
                          "id": "gid://shopify/DiscountAutomaticNode/299501151",
                          "discount": {
                            "title": "Black Friday discount"
                          }
                        }
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/755492298",
                  "split": 0,
                  "changes": {
                    "nodes": [],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": false
          }
        }
      }
    }
  }
  ```

* ### Inspect a rollout that replaces one discount with another

  #### Description

  Inspect the treatments of a rollout that activates a sale discount and expires a clearance discount. The treatment with no changes keeps the discounts' native behavior. Use \`\_\_typename\` to distinguish \`RolloutDiscountActivateChange\` from \`RolloutDiscountExpireChange\`. Select their shared discount fields through the \`RolloutDiscountChange\` interface. The changes connection includes sibling discounts, not just the discount used to find the rollout. These operations affect the buyers served by the treatment; they don't mean the discount's native dates changed. Your app needs both \`read\_discounts\` and \`read\_rollouts\` access scopes.

  #### Query

  ```graphql
  query DiscountOfferChangeover($id: ID!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            nodes {
              id
              name
              status
              treatments {
                id
                split
                changes(first: 10) {
                  nodes {
                    id
                    __typename
                    ... on RolloutDiscountChange {
                      discount {
                        id
                        discount {
                          ... on DiscountAutomaticBasic {
                            title
                          }
                          ... on DiscountCodeBasic {
                            title
                          }
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscountOfferChangeover($id: ID!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { title rollouts(first: 10) { nodes { id name status treatments { id split changes(first: 10) { nodes { id __typename ... on RolloutDiscountChange { discount { id discount { ... on DiscountAutomaticBasic { title } ... on DiscountCodeBasic { title } } } } } pageInfo { hasNextPage } } } } pageInfo { hasNextPage } } } } } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscountOfferChangeover($id: ID!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              nodes {
                id
                name
                status
                treatments {
                  id
                  split
                  changes(first: 10) {
                    nodes {
                      id
                      __typename
                      ... on RolloutDiscountChange {
                        discount {
                          id
                          discount {
                            ... on DiscountAutomaticBasic {
                              title
                            }
                            ... on DiscountCodeBasic {
                              title
                            }
                          }
                        }
                      }
                    }
                    pageInfo {
                      hasNextPage
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscountOfferChangeover($id: ID!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              nodes {
                id
                name
                status
                treatments {
                  id
                  split
                  changes(first: 10) {
                    nodes {
                      id
                      __typename
                      ... on RolloutDiscountChange {
                        discount {
                          id
                          discount {
                            ... on DiscountAutomaticBasic {
                              title
                            }
                            ... on DiscountCodeBasic {
                              title
                            }
                          }
                        }
                      }
                    }
                    pageInfo {
                      hasNextPage
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscountOfferChangeover($id: ID!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              title
              rollouts(first: 10) {
                nodes {
                  id
                  name
                  status
                  treatments {
                    id
                    split
                    changes(first: 10) {
                      nodes {
                        id
                        __typename
                        ... on RolloutDiscountChange {
                          discount {
                            id
                            discount {
                              ... on DiscountAutomaticBasic {
                                title
                              }
                              ... on DiscountCodeBasic {
                                title
                              }
                            }
                          }
                        }
                      }
                      pageInfo {
                        hasNextPage
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                }
              }
            }
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscountOfferChangeover($id: ID!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            nodes {
              id
              name
              status
              treatments {
                id
                split
                changes(first: 10) {
                  nodes {
                    id
                    __typename
                    ... on RolloutDiscountChange {
                      discount {
                        id
                        discount {
                          ... on DiscountAutomaticBasic {
                            title
                          }
                          ... on DiscountCodeBasic {
                            title
                          }
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscountOfferChangeover($id: ID!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                title
                rollouts(first: 10) {
                  nodes {
                    id
                    name
                    status
                    treatments {
                      id
                      split
                      changes(first: 10) {
                        nodes {
                          id
                          __typename
                          ... on RolloutDiscountChange {
                            discount {
                              id
                              discount {
                                ... on DiscountAutomaticBasic {
                                  title
                                }
                                ... on DiscountCodeBasic {
                                  title
                                }
                              }
                            }
                          }
                        }
                        pageInfo {
                          hasNextPage
                        }
                      }
                    }
                  }
                  pageInfo {
                    hasNextPage
                  }
                }
              }
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "title": "Black Friday discount",
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/532060658",
              "name": "Black Friday offer changeover",
              "status": "ACTIVE",
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/522314081",
                  "split": 50,
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/19562284969ac8973c308a5159bf122bb6cc5966282d620bfbf81e7029f1e686",
                        "__typename": "RolloutDiscountActivateChange",
                        "discount": {
                          "id": "gid://shopify/DiscountAutomaticNode/299501151",
                          "discount": {
                            "title": "Black Friday discount"
                          }
                        }
                      },
                      {
                        "id": "gid://shopify/RolloutDiscountExpireChange/c2f0dd9c068a6dba4866e563632bc485070d427fd72568094e761b30fa639467",
                        "__typename": "RolloutDiscountExpireChange",
                        "discount": {
                          "id": "gid://shopify/DiscountCodeNode/672017907",
                          "discount": {
                            "title": "Clearance discount"
                          }
                        }
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/755492298",
                  "split": 50,
                  "changes": {
                    "nodes": [],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": false
          }
        }
      }
    }
  }
  ```

* ### Querying a non-existent discount returns null

  #### Description

  This example shows the response that's returned when you query a discount that doesn't exist.

  #### Query

  ```graphql
  query {
    discountNode(id: "gid://shopify/DiscountNode/999999999") {
      id
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query { discountNode(id: \"gid://shopify/DiscountNode/999999999\") { id } }"
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query {
      discountNode(id: "gid://shopify/DiscountNode/999999999") {
        id
      }
    }`,
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query {
      discountNode(id: "gid://shopify/DiscountNode/999999999") {
        id
      }
    }
  QUERY

  response = client.query(query: query)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: `query {
      discountNode(id: "gid://shopify/DiscountNode/999999999") {
        id
      }
    }`,
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query {
    discountNode(id: "gid://shopify/DiscountNode/999999999") {
      id
    }
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query {
          discountNode(id: "gid://shopify/DiscountNode/999999999") {
            id
          }
        }
      `,
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": null
  }
  ```

* ### Read a discount's rollout changes and configured traffic

  #### Description

  Read changes for a basic automatic or code discount together with rollout allocation and treatment splits. Use \`discount\_id:\` with a numeric discount ID or a quoted GID, passing the complete expression in \`changeQuery\`. In this example, the treatment that activates the natively expired discount has 50% of a 40% rollout allocation: 20% configured traffic. Buyers outside that treatment receive no activation from this rollout. Competing rollouts and discount eligibility can further limit who can use the discount. Do not advertise this discount as available to all buyers. Check the rollout's status before treating its configuration as active. These percentages precede competing-rollout effects; they aren't measured exposure or proof that a buyer can redeem the discount. Activation and expiration affect buyers served by a treatment; they don't change the discount's native dates. An empty filtered connection for a treatment means no matching readable changes were returned there. It does not prove that no change exists or that the discount is unavailable. Your app needs both \`read\_discounts\` and \`read\_rollouts\` access scopes.

  #### Query

  ```graphql
  query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountTrafficRollouts
          }
        }
        ... on DiscountCodeBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountTrafficRollouts
          }
        }
      }
    }
  }

  fragment DiscountTrafficRollouts on RolloutConnection {
    nodes {
      id
      name
      status
      trafficAllocation
      treatments {
        id
        split
        changes(first: 10, query: $changeQuery) {
          nodes {
            id
            __typename
            ... on RolloutDiscountChange {
              discount {
                id
                discount {
                  ... on DiscountAutomaticBasic {
                    title
                  }
                  ... on DiscountCodeBasic {
                    title
                  }
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) { discountNode(id: $id) { discount { ... on DiscountAutomaticBasic { title status startsAt endsAt rollouts(first: 10) { ...DiscountTrafficRollouts } } ... on DiscountCodeBasic { title status startsAt endsAt rollouts(first: 10) { ...DiscountTrafficRollouts } } } } } fragment DiscountTrafficRollouts on RolloutConnection { nodes { id name status trafficAllocation treatments { id split changes(first: 10, query: $changeQuery) { nodes { id __typename ... on RolloutDiscountChange { discount { id discount { ... on DiscountAutomaticBasic { title } ... on DiscountCodeBasic { title } } } } } pageInfo { hasNextPage } } } } pageInfo { hasNextPage } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151",
      "changeQuery": "discount_id:'\''gid://shopify/DiscountNode/299501151'\''"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountTrafficRollouts
            }
          }
          ... on DiscountCodeBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountTrafficRollouts
            }
          }
        }
      }
    }
    
    fragment DiscountTrafficRollouts on RolloutConnection {
      nodes {
        id
        name
        status
        trafficAllocation
        treatments {
          id
          split
          changes(first: 10, query: $changeQuery) {
            nodes {
              id
              __typename
              ... on RolloutDiscountChange {
                discount {
                  id
                  discount {
                    ... on DiscountAutomaticBasic {
                      title
                    }
                    ... on DiscountCodeBasic {
                      title
                    }
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
      pageInfo {
        hasNextPage
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
      discountNode(id: $id) {
        discount {
          ... on DiscountAutomaticBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountTrafficRollouts
            }
          }
          ... on DiscountCodeBasic {
            title
            status
            startsAt
            endsAt
            rollouts(first: 10) {
              ...DiscountTrafficRollouts
            }
          }
        }
      }
    }
    
    fragment DiscountTrafficRollouts on RolloutConnection {
      nodes {
        id
        name
        status
        trafficAllocation
        treatments {
          id
          split
          changes(first: 10, query: $changeQuery) {
            nodes {
              id
              __typename
              ... on RolloutDiscountChange {
                discount {
                  id
                  discount {
                    ... on DiscountAutomaticBasic {
                      title
                    }
                    ... on DiscountCodeBasic {
                      title
                    }
                  }
                }
              }
            }
            pageInfo {
              hasNextPage
            }
          }
        }
      }
      pageInfo {
        hasNextPage
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
        discountNode(id: $id) {
          discount {
            ... on DiscountAutomaticBasic {
              title
              status
              startsAt
              endsAt
              rollouts(first: 10) {
                ...DiscountTrafficRollouts
              }
            }
            ... on DiscountCodeBasic {
              title
              status
              startsAt
              endsAt
              rollouts(first: 10) {
                ...DiscountTrafficRollouts
              }
            }
          }
        }
      }
      
      fragment DiscountTrafficRollouts on RolloutConnection {
        nodes {
          id
          name
          status
          trafficAllocation
          treatments {
            id
            split
            changes(first: 10, query: $changeQuery) {
              nodes {
                id
                __typename
                ... on RolloutDiscountChange {
                  discount {
                    id
                    discount {
                      ... on DiscountAutomaticBasic {
                        title
                      }
                      ... on DiscountCodeBasic {
                        title
                      }
                    }
                  }
                }
              }
              pageInfo {
                hasNextPage
              }
            }
          }
        }
        pageInfo {
          hasNextPage
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
    discountNode(id: $id) {
      discount {
        ... on DiscountAutomaticBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountTrafficRollouts
          }
        }
        ... on DiscountCodeBasic {
          title
          status
          startsAt
          endsAt
          rollouts(first: 10) {
            ...DiscountTrafficRollouts
          }
        }
      }
    }
  }

  fragment DiscountTrafficRollouts on RolloutConnection {
    nodes {
      id
      name
      status
      trafficAllocation
      treatments {
        id
        split
        changes(first: 10, query: $changeQuery) {
          nodes {
            id
            __typename
            ... on RolloutDiscountChange {
              discount {
                id
                discount {
                  ... on DiscountAutomaticBasic {
                    title
                  }
                  ... on DiscountCodeBasic {
                    title
                  }
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151",
    "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscountRolloutTraffic($id: ID!, $changeQuery: String!) {
          discountNode(id: $id) {
            discount {
              ... on DiscountAutomaticBasic {
                title
                status
                startsAt
                endsAt
                rollouts(first: 10) {
                  ...DiscountTrafficRollouts
                }
              }
              ... on DiscountCodeBasic {
                title
                status
                startsAt
                endsAt
                rollouts(first: 10) {
                  ...DiscountTrafficRollouts
                }
              }
            }
          }
        }
        
        fragment DiscountTrafficRollouts on RolloutConnection {
          nodes {
            id
            name
            status
            trafficAllocation
            treatments {
              id
              split
              changes(first: 10, query: $changeQuery) {
                nodes {
                  id
                  __typename
                  ... on RolloutDiscountChange {
                    discount {
                      id
                      discount {
                        ... on DiscountAutomaticBasic {
                          title
                        }
                        ... on DiscountCodeBasic {
                          title
                        }
                      }
                    }
                  }
                }
                pageInfo {
                  hasNextPage
                }
              }
            }
          }
          pageInfo {
            hasNextPage
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151",
          "changeQuery": "discount_id:'gid://shopify/DiscountNode/299501151'"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "discount": {
        "title": "Black Friday discount",
        "status": "EXPIRED",
        "startsAt": "2026-01-01T00:00:00Z",
        "endsAt": "2026-01-02T00:00:00Z",
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/532060658",
              "name": "Black Friday offer changeover",
              "status": "ACTIVE",
              "trafficAllocation": 40,
              "treatments": [
                {
                  "id": "gid://shopify/RolloutTreatment/522314081",
                  "split": 50,
                  "changes": {
                    "nodes": [
                      {
                        "id": "gid://shopify/RolloutDiscountActivateChange/19562284969ac8973c308a5159bf122bb6cc5966282d620bfbf81e7029f1e686",
                        "__typename": "RolloutDiscountActivateChange",
                        "discount": {
                          "id": "gid://shopify/DiscountAutomaticNode/299501151",
                          "discount": {
                            "title": "Black Friday discount"
                          }
                        }
                      }
                    ],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                },
                {
                  "id": "gid://shopify/RolloutTreatment/755492298",
                  "split": 50,
                  "changes": {
                    "nodes": [],
                    "pageInfo": {
                      "hasNextPage": false
                    }
                  }
                }
              ]
            }
          ],
          "pageInfo": {
            "hasNextPage": false
          }
        }
      }
    }
  }
  ```

* ### Read the rollouts associated with a discount

  #### Description

  Read the names, statuses, and schedules of rollouts that include a discount. The query includes fragments for all eight discount types; keep the fragments your app needs. Your app needs both \`read\_discounts\` and \`read\_rollouts\` access scopes. A rollout's schedule is separate from the discount's own start and end dates. Membership alone doesn't establish whether a buyer can use the discount. If \`hasNextPage\` is \`true\`, \[paginate the rollouts connection]\(https://shopify.dev/docs/api/usage/pagination-graphql).

  #### Query

  ```graphql
  query DiscountRollouts($id: ID!) {
    discountNode(id: $id) {
      id
      discount {
        __typename
        ... on DiscountAutomaticApp {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticBxgy {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticFreeShipping {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeApp {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeBasic {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeBxgy {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeFreeShipping {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
      }
    }
  }

  fragment RolloutMemberships on RolloutConnection {
    nodes {
      id
      name
      status
      schedule {
        activateAt
        concludeAt
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/DiscountNode/299501151"
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query DiscountRollouts($id: ID!) { discountNode(id: $id) { id discount { __typename ... on DiscountAutomaticApp { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountAutomaticBasic { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountAutomaticBxgy { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountAutomaticFreeShipping { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountCodeApp { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountCodeBasic { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountCodeBxgy { title rollouts(first: 10) { ...RolloutMemberships } } ... on DiscountCodeFreeShipping { title rollouts(first: 10) { ...RolloutMemberships } } } } } fragment RolloutMemberships on RolloutConnection { nodes { id name status schedule { activateAt concludeAt } } pageInfo { hasNextPage endCursor } }",
   "variables": {
      "id": "gid://shopify/DiscountNode/299501151"
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query DiscountRollouts($id: ID!) {
      discountNode(id: $id) {
        id
        discount {
          __typename
          ... on DiscountAutomaticApp {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticBxgy {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticFreeShipping {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeApp {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeBasic {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeBxgy {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeFreeShipping {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
        }
      }
    }
    
    fragment RolloutMemberships on RolloutConnection {
      nodes {
        id
        name
        status
        schedule {
          activateAt
          concludeAt
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query DiscountRollouts($id: ID!) {
      discountNode(id: $id) {
        id
        discount {
          __typename
          ... on DiscountAutomaticApp {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticBasic {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticBxgy {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountAutomaticFreeShipping {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeApp {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeBasic {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeBxgy {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
          ... on DiscountCodeFreeShipping {
            title
            rollouts(first: 10) {
              ...RolloutMemberships
            }
          }
        }
      }
    }
    
    fragment RolloutMemberships on RolloutConnection {
      nodes {
        id
        name
        status
        schedule {
          activateAt
          concludeAt
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/DiscountNode/299501151"
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `query DiscountRollouts($id: ID!) {
        discountNode(id: $id) {
          id
          discount {
            __typename
            ... on DiscountAutomaticApp {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountAutomaticBasic {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountAutomaticBxgy {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountAutomaticFreeShipping {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountCodeApp {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountCodeBasic {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountCodeBxgy {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
            ... on DiscountCodeFreeShipping {
              title
              rollouts(first: 10) {
                ...RolloutMemberships
              }
            }
          }
        }
      }
      
      fragment RolloutMemberships on RolloutConnection {
        nodes {
          id
          name
          status
          schedule {
            activateAt
            concludeAt
          }
        }
        pageInfo {
          hasNextPage
          endCursor
        }
      }`,
      "variables": {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query DiscountRollouts($id: ID!) {
    discountNode(id: $id) {
      id
      discount {
        __typename
        ... on DiscountAutomaticApp {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticBasic {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticBxgy {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountAutomaticFreeShipping {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeApp {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeBasic {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeBxgy {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
        ... on DiscountCodeFreeShipping {
          title
          rollouts(first: 10) {
            ...RolloutMemberships
          }
        }
      }
    }
  }

  fragment RolloutMemberships on RolloutConnection {
    nodes {
      id
      name
      status
      schedule {
        activateAt
        concludeAt
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/DiscountNode/299501151"
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query DiscountRollouts($id: ID!) {
          discountNode(id: $id) {
            id
            discount {
              __typename
              ... on DiscountAutomaticApp {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountAutomaticBasic {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountAutomaticBxgy {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountAutomaticFreeShipping {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountCodeApp {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountCodeBasic {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountCodeBxgy {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
              ... on DiscountCodeFreeShipping {
                title
                rollouts(first: 10) {
                  ...RolloutMemberships
                }
              }
            }
          }
        }
        
        fragment RolloutMemberships on RolloutConnection {
          nodes {
            id
            name
            status
            schedule {
              activateAt
              concludeAt
            }
          }
          pageInfo {
            hasNextPage
            endCursor
          }
        }
      `,
      variables: {
          "id": "gid://shopify/DiscountNode/299501151"
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "id": "gid://shopify/DiscountAutomaticNode/299501151",
      "discount": {
        "__typename": "DiscountAutomaticBasic",
        "title": "My automatic discount",
        "rollouts": {
          "nodes": [
            {
              "id": "gid://shopify/Rollout/885624881",
              "name": "Black Friday sale",
              "status": "SCHEDULED",
              "schedule": {
                "activateAt": "2026-11-27T00:00:00Z",
                "concludeAt": "2026-12-01T00:00:00Z"
              }
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "endCursor": "eyJsYXN0X2lkIjo4ODU2MjQ4ODEsImxhc3RfdmFsdWUiOiI4ODU2MjQ4ODEifQ=="
          }
        }
      }
    }
  }
  ```

* ### Retrieve a discount by its ID

  #### Description

  Retrieve a \[discount]\(https://help.shopify.com/manual/discounts) that's applied on a cart and at checkout when an order meets specific criteria.

  #### Query

  ```graphql
  query {
    discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
      id
      discount {
        ... on DiscountCodeBasic {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticBasic {
          title
          summary
          status
        }
        ... on DiscountCodeBxgy {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticBxgy {
          title
          summary
          status
        }
        ... on DiscountCodeFreeShipping {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountCodeApp {
          title
          status
          appDiscountType {
            title
          }
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticApp {
          title
          status
          appDiscountType {
            title
          }
        }
      }
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "query { discountNode(id: \"gid://shopify/DiscountAutomaticNode/299501151\") { id discount { ... on DiscountCodeBasic { title summary status codes(first: 1) { nodes { code } } } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status codes(first: 1) { nodes { code } } } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status codes(first: 1) { nodes { code } } } ... on DiscountCodeApp { title status appDiscountType { title } codes(first: 1) { nodes { code } } } ... on DiscountAutomaticApp { title status appDiscountType { title } } } } }"
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    query {
      discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
        id
        discount {
          ... on DiscountCodeBasic {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBasic {
            title
            summary
            status
          }
          ... on DiscountCodeBxgy {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBxgy {
            title
            summary
            status
          }
          ... on DiscountCodeFreeShipping {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountCodeApp {
            title
            status
            appDiscountType {
              title
            }
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticApp {
            title
            status
            appDiscountType {
              title
            }
          }
        }
      }
    }`,
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    query {
      discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
        id
        discount {
          ... on DiscountCodeBasic {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBasic {
            title
            summary
            status
          }
          ... on DiscountCodeBxgy {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBxgy {
            title
            summary
            status
          }
          ... on DiscountCodeFreeShipping {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountCodeApp {
            title
            status
            appDiscountType {
              title
            }
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticApp {
            title
            status
            appDiscountType {
              title
            }
          }
        }
      }
    }
  QUERY

  response = client.query(query: query)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: `query {
      discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
        id
        discount {
          ... on DiscountCodeBasic {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBasic {
            title
            summary
            status
          }
          ... on DiscountCodeBxgy {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticBxgy {
            title
            summary
            status
          }
          ... on DiscountCodeFreeShipping {
            title
            summary
            status
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountCodeApp {
            title
            status
            appDiscountType {
              title
            }
            codes(first: 1) {
              nodes {
                code
              }
            }
          }
          ... on DiscountAutomaticApp {
            title
            status
            appDiscountType {
              title
            }
          }
        }
      }
    }`,
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'query {
    discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
      id
      discount {
        ... on DiscountCodeBasic {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticBasic {
          title
          summary
          status
        }
        ... on DiscountCodeBxgy {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticBxgy {
          title
          summary
          status
        }
        ... on DiscountCodeFreeShipping {
          title
          summary
          status
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountCodeApp {
          title
          status
          appDiscountType {
            title
          }
          codes(first: 1) {
            nodes {
              code
            }
          }
        }
        ... on DiscountAutomaticApp {
          title
          status
          appDiscountType {
            title
          }
        }
      }
    }
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        query {
          discountNode(id: "gid://shopify/DiscountAutomaticNode/299501151") {
            id
            discount {
              ... on DiscountCodeBasic {
                title
                summary
                status
                codes(first: 1) {
                  nodes {
                    code
                  }
                }
              }
              ... on DiscountAutomaticBasic {
                title
                summary
                status
              }
              ... on DiscountCodeBxgy {
                title
                summary
                status
                codes(first: 1) {
                  nodes {
                    code
                  }
                }
              }
              ... on DiscountAutomaticBxgy {
                title
                summary
                status
              }
              ... on DiscountCodeFreeShipping {
                title
                summary
                status
                codes(first: 1) {
                  nodes {
                    code
                  }
                }
              }
              ... on DiscountCodeApp {
                title
                status
                appDiscountType {
                  title
                }
                codes(first: 1) {
                  nodes {
                    code
                  }
                }
              }
              ... on DiscountAutomaticApp {
                title
                status
                appDiscountType {
                  title
                }
              }
            }
          }
        }
      `,
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "discountNode": {
      "id": "gid://shopify/DiscountAutomaticNode/299501151",
      "discount": {
        "title": "My automatic discount",
        "summary": "$100.00 off entire order • Minimum quantity of 1",
        "status": "SCHEDULED"
      }
    }
  }
  ```
