Skip to Content
StoreOSv0.27.1
Core GraphQL APIReferenceQueries

Sale__discount

{ collectionName: 'sale__Discount', permissions: ['*', 'read'], } Requires a signed-in staff user. Needs the `sale__Discount` `read` permission. Send the `x-tenant` header (the gateway sets it from your API key).

QUERYsale__discount(where: CommonFindDocumentDto!): Discount!

{ collectionName: 'sale__Discount', permissions: ['*', 'read'], } Requires a signed-in staff user. Needs the sale__Discount read permission. Send the x-tenant header (the gateway sets it from your API key).

Arguments

where*

Returns

  1. sale__discount
_id*ID!
appliesTo?

Products a PRODUCT_AMOUNT discount applies to.

buyXGetY?
code?String

Customer-entered code. Only set when method is CODE.

combinesWith?
commits?
createdAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

eligibility?
endsAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

freeShipping?
isActive*Boolean!
isDemo?Boolean
method*DiscountMethod!
Value inAUTOMATICCODE
minimumRequirement?
oncePerCustomer*Boolean!
startsAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

tenant?String
title*String!
type*DiscountType!
Value inBUY_X_GET_YFREE_SHIPPINGORDER_AMOUNTPRODUCT_AMOUNT
updatedAt?DateTime

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

usageCount?Int

Orders that used this discount. Resolved on read.

usageLimit?Int

Total redemptions across all customers. Empty means no limit.

value?

Used by PRODUCT_AMOUNT and ORDER_AMOUNT discounts.

Example Request
query Sale__discount($where: CommonFindDocumentDto!) {  sale__discount(where: $where) {    _id    appliesTo {      collectionIds      productIds      scope    }    buyXGetY {      buys {        collectionIds        minAmount        minQuantity        productIds        scope      }      gets {        collectionIds        productIds        quantity        scope      }      maxUsesPerOrder    }    code    createdAt    endsAt    isActive    isDemo    method    oncePerCustomer  }}
Variables
{  "where": {    "and": [      {        "and": [          {            "and": [              {                "and": [                  {}                ],                "key": "string"              }            ],            "key": "string"          }        ],        "key": "string"      }    ],    "key": "string"  }}
Example Response
{  "data": {    "sale__discount": {      "_id": "1",      "appliesTo": {        "collectionIds": [          "string"        ],        "productIds": [          "string"        ],        "scope": "ALL"      },      "buyXGetY": {        "buys": {          "collectionIds": [            "string"          ],          "minAmount": 10.5,          "minQuantity": 10,          "productIds": [            "string"          ],          "scope": "ALL"        },        "gets": {          "collectionIds": [            "string"          ],          "productIds": [            "string"          ],          "quantity": 10,          "scope": "ALL"        },        "maxUsesPerOrder": 10      },      "code": "string",      "createdAt": "<DateTime>",      "endsAt": "<DateTime>",      "isActive": true,      "isDemo": true,      "method": "AUTOMATIC",      "oncePerCustomer": true    }  }}