--- title: automaticDiscountNode - GraphQL Admin description: Returns a `DiscountAutomaticNode` resource by ID. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/automaticDiscountNode md: https://shopify.dev/docs/api/admin-graphql/latest/queries/automaticDiscountNode.md --- # automatic​Discount​Node query Returns a `DiscountAutomaticNode` resource by ID. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) required The ID of the `DiscountAutomaticNode` to return. *** ## Possible returns * Discount​Automatic​Node [Discount​Automatic​Node](https://shopify.dev/docs/api/admin-graphql/latest/objects/DiscountAutomaticNode) The `DiscountAutomaticNode` object enables you to manage [automatic discounts](https://help.shopify.com/manual/discounts/discount-types#automatic-discounts) that are applied when an order meets specific criteria. You can create amount off, free shipping, or buy X get Y automatic discounts. For example, you can offer customers a free shipping discount that applies when conditions are met. Or you can offer customers a buy X get Y discount that's automatically applied when customers spend a specified amount of money, or a specified quantity of products. Learn more about working with [Shopify's discount model](https://shopify.dev/docs/apps/build/discounts), including related queries, mutations, limitations, and considerations. *** ## Examples * ### Retrieve a buy X get Y automatic discount by its ID #### Description Retrieve a \[buy X get Y]\(https\://help.shopify.com/manual/discounts/discount-types/buy-x-get-y) discount that's automatically applied on a cart and at checkout when an order meets specific criteria. #### Query ```graphql query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { automaticDiscountNode(id: \"gid://shopify/DiscountAutomaticNode/1057371284\") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }" }' ``` #### 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 { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }`, ); 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 { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }`, }); ``` #### Response ```json { "automaticDiscountNode": { "id": "gid://shopify/DiscountAutomaticNode/1057371284", "automaticDiscount": { "title": "An automatic bogo discount", "status": "SCHEDULED" } } } ``` * ### Retrieve an automatic discount by its ID #### Description Retrieve an automatic discount that's managed by an app using \[Shopify Functions]\(https\://shopify.dev/docs/apps/build/functions). #### Query ```graphql query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371285") { id automaticDiscount { ... on DiscountAutomaticApp { title status } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { automaticDiscountNode(id: \"gid://shopify/DiscountAutomaticNode/1057371285\") { id automaticDiscount { ... on DiscountAutomaticApp { title status } } } }" }' ``` #### 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 { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371285") { id automaticDiscount { ... on DiscountAutomaticApp { title status } } } }`, ); 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 { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371285") { id automaticDiscount { ... on DiscountAutomaticApp { title status } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371285") { id automaticDiscount { ... on DiscountAutomaticApp { title status } } } }`, }); ``` #### Response ```json { "automaticDiscountNode": { "id": "gid://shopify/DiscountAutomaticNode/1057371285", "automaticDiscount": { "title": "An automatic app discount", "status": "ACTIVE" } } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20%7B%0A%20%20automaticDiscountNode\(id%3A%20%22gid%3A%2F%2Fshopify%2FDiscountAutomaticNode%2F1057371284%22\)%20%7B%0A%20%20%20%20id%0A%20%20%20%20automaticDiscount%20%7B%0A%20%20%20%20%20%20...%20on%20DiscountAutomaticBxgy%20%7B%0A%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20status%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }`, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { automaticDiscountNode(id: \"gid://shopify/DiscountAutomaticNode/1057371284\") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }" }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }`, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } }`, }); ``` ##### 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 { automaticDiscountNode(id: "gid://shopify/DiscountAutomaticNode/1057371284") { id automaticDiscount { ... on DiscountAutomaticBxgy { title status } } } } QUERY response = client.query(query: query) ``` ## Response JSON ```json { "automaticDiscountNode": { "id": "gid://shopify/DiscountAutomaticNode/1057371284", "automaticDiscount": { "title": "An automatic bogo discount", "status": "SCHEDULED" } } } ```