--- title: discountNodes - GraphQL Admin description: Returns a list of discounts. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/discountNodes md: https://shopify.dev/docs/api/admin-graphql/latest/queries/discountNodes.md --- # discount​Nodes query Requires Apps must have `read_discounts` access scope. Returns a list of discounts. ## DiscountNodeConnection arguments [DiscountNodeConnection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/DiscountNodeConnection) * after [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) 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). * * default string * code string * combines\_with string * created\_at time * discount\_class string * discount\_type string * ends\_at time * id id * method string * starts\_at time * status string * times\_used integer * title 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 discount code. Not supported for bulk discounts. - Example: * `code:WELCOME10` Filter by the [Shopify Functions discount classes](https://shopify.dev/docs/apps/build/discounts#discount-classes) that the [discount type](https://shopify.dev/docs/api/admin-graphql/latest/queries/discountnodes#argument-query-filter-discount_type) can combine with. - Valid values: * `order_discounts` * `product_discounts` * `shipping_discounts` Example: * `combines_with:product_discounts` Filter by the date and time, in the shop's timezone, when the discount was created. - Example: * `created_at:>'2020-10-21T23:39:20Z'` * `created_at:'2020-10-21T23:39:20Z'` * `ends_at:=1234` * `id:<=1234` Filter by the [discount method](https://shopify.dev/docs/apps/build/discounts#discount-methods). - Valid values: * `automatic` * `code` Example: * `method:code` Filter by the date and time, in the shop's timezone, when the discount becomes active and is available for customer use. - Example: * `starts_at:>'2020-10-21T23:39:20Z'` * `starts_at:150` * `times_used:>=200` Filter by the discount name that displays to merchants in the Shopify admin and to customers. - Example: * `title:Black Friday Sale` Filter by the [discount type](https://help.shopify.com/manual/discounts/discount-types). - Valid values: * `all` * `all_with_app` * `app` * `bxgy` * `fixed_amount` * `free_shipping` * `percentage` Example: * `type:percentage` Filter by the date and time, in the shop's timezone, when the discount was last updated. Example: * `updated_at:>'2020-10-21T23:39:20Z'` * `updated_at: { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { discountNodes(query: "combines_with:product_discounts", first: 10) { edges { node { id discount { ... on DiscountCodeBasic { title status combinesWith { productDiscounts } } ... on DiscountCodeFreeShipping { title status combinesWith { productDiscounts } } } } } } }`, ); 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 { discountNodes(query: "combines_with:product_discounts", first: 10) { edges { node { id discount { ... on DiscountCodeBasic { title status combinesWith { productDiscounts } } ... on DiscountCodeFreeShipping { title status combinesWith { productDiscounts } } } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { discountNodes(query: "combines_with:product_discounts", first: 10) { edges { node { id discount { ... on DiscountCodeBasic { title status combinesWith { productDiscounts } } ... on DiscountCodeFreeShipping { title status combinesWith { productDiscounts } } } } } } }`, }); ``` #### Response ```json { "discountNodes": { "edges": [ { "node": { "id": "gid://shopify/DiscountCodeNode/700447567", "discount": { "title": "COMBINABLEFREESHIPPING", "status": "ACTIVE", "combinesWith": { "productDiscounts": true } } } }, { "node": { "id": "gid://shopify/DiscountCodeNode/988849754", "discount": { "title": "combinable_cart_amount", "status": "EXPIRED", "combinesWith": { "productDiscounts": true } } } } ] } } ``` * ### Retrieve a list of discounts #### Description Retrieve the first five discounts for a shop. You can retrieve \[discount types]\(https\://help.shopify.com/manual/discounts/discount-types) that offer buy X get Y (BXGY), amount off, and free shipping. You can also retrieve discounts that are managed by an app that's using \[Shopify Functions]\(https\://shopify.dev/docs/apps/build/functions). #### Query ```graphql query { discountNodes(first: 5) { edges { node { id __typename discount { ... on DiscountCodeBasic { title summary status } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status } ... on DiscountAutomaticApp { title status appDiscountType { functionId } } } } } } } ``` #### 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 { discountNodes(first: 5) { edges { node { id __typename discount { ... on DiscountCodeBasic { title summary status } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status } ... on DiscountAutomaticApp { title status appDiscountType { functionId } } } } } } }" }' ``` #### 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 { discountNodes(first: 5) { edges { node { id __typename discount { ... on DiscountCodeBasic { title summary status } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status } ... on DiscountAutomaticApp { title status appDiscountType { functionId } } } } } } }`, ); 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 { discountNodes(first: 5) { edges { node { id __typename discount { ... on DiscountCodeBasic { title summary status } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status } ... on DiscountAutomaticApp { title status appDiscountType { functionId } } } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { discountNodes(first: 5) { edges { node { id __typename discount { ... on DiscountCodeBasic { title summary status } ... on DiscountAutomaticBasic { title summary status } ... on DiscountCodeBxgy { title summary status } ... on DiscountAutomaticBxgy { title summary status } ... on DiscountCodeFreeShipping { title summary status } ... on DiscountAutomaticApp { title status appDiscountType { functionId } } } } } } }`, }); ``` #### Response ```json { "discountNodes": { "edges": [ { "node": { "id": "gid://shopify/DiscountCodeNode/2429471", "__typename": "DiscountNode", "discount": { "title": "cart_amount", "summary": "$10.00 off one-time purchase products", "status": "EXPIRED" } } }, { "node": { "id": "gid://shopify/DiscountAutomaticNode/52422887", "__typename": "DiscountNode", "discount": { "title": "Percentage off (by Automatic App Discount)", "status": "EXPIRED", "appDiscountType": { "functionId": "9476d0af-de36-4159-a6cd-b68165c2deac" } } } }, { "node": { "id": "gid://shopify/DiscountAutomaticNode/198286294", "__typename": "DiscountNode", "discount": { "title": "My automatic bogo", "summary": "Buy 1 item, get 1 item free", "status": "EXPIRED" } } }, { "node": { "id": "gid://shopify/DiscountAutomaticNode/299501151", "__typename": "DiscountNode", "discount": { "title": "My automatic discount", "summary": "$100.00 off entire order • Minimum quantity of 1", "status": "SCHEDULED" } } }, { "node": { "id": "gid://shopify/DiscountCodeNode/299564956", "__typename": "DiscountNode", "discount": { "title": "product_bogo", "summary": "Buy 1 item, get 1 item free", "status": "EXPIRED" } } } ] } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20%7B%0A%20%20discountNodes\(query%3A%20%22combines_with%3Aproduct_discounts%22%2C%20first%3A%2010\)%20%7B%0A%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20discount%20%7B%0A%20%20%20%20%20%20%20%20%20%20...%20on%20DiscountCodeBasic%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20%20%20%20%20status%0A%20%20%20%20%20%20%20%20%20%20%20%20combinesWith%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20productDiscounts%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20...%20on%20DiscountCodeFreeShipping%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20%20%20%20%20status%0A%20%20%20%20%20%20%20%20%20%20%20%20combinesWith%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20productDiscounts%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%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 { discountNodes(query: "combines_with:product_discounts", first: 10) { edges { node { id discount { ... on DiscountCodeBasic { title status combinesWith { productDiscounts } } ... on DiscountCodeFreeShipping { title status combinesWith { productDiscounts } } } } } } }`, ); const json = await response.json(); return json.data; } ``` ## Response JSON ```json { "discountNodes": { "edges": [ { "node": { "id": "gid://shopify/DiscountCodeNode/700447567", "discount": { "title": "COMBINABLEFREESHIPPING", "status": "ACTIVE", "combinesWith": { "productDiscounts": true } } } }, { "node": { "id": "gid://shopify/DiscountCodeNode/988849754", "discount": { "title": "combinable_cart_amount", "status": "EXPIRED", "combinesWith": { "productDiscounts": true } } } } ] } } ```