Skip to main content
object

Requires Apps must have read_discounts access scope.

The DiscountCodeBxgy object lets you manage buy X get Y discounts (BXGY) that are applied on a cart and at checkout when a customer enters a code. BXGY discounts incentivize customers by offering them additional items at a discounted price or for free when they purchase a specified quantity of items.

The DiscountCodeBxgy object stores information about BXGY code discounts that apply to specific products and variants, collections, or all items in a cart.

Learn more about working with Shopify's discount model, including limitations and considerations.


Note

The DiscountAutomaticBxgy object has similar functionality to the DiscountCodeBxgy object, but discounts are automatically applied, without the need for customers to enter a code.


Anchor to appliesOncePerCustomerappliesOncePerCustomer
•Boolean!
non-null

Whether a customer can only use the discount once.

•Int!
non-null

The number of times that the discount has been used. For example, if a "Buy 3, Get 1 Free" t-shirt discount is automatically applied in 200 transactions, then the discount has been used 200 times. This value is updated asynchronously. As a result, it might be lower than the actual usage count until the asynchronous process is completed.

•DiscountRedeemCodeConnection!
non-null

A list codes that customers can use to redeem the discount.

Arguments

•Int

The first n elements from the paginated list.

•String

The elements that come after the specified cursor.

•Int

The last n elements from the paginated list.

•String

The elements that come before the specified cursor.

•Boolean
Default:false

Reverse the order of the underlying list.

•DiscountCodeSortKeys
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.

•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.

Anchor to default
•string

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

Example:

  • query=Bob Norman
  • query=title:green hoodie
•id

Filter by id range.

Example:

  • id:1234
  • id:>=1234
  • id:<=1234
Anchor to times_used
•integer
•ID

The ID of a saved search. The search’s query string is used as the query argument.


•Count

The number of codes that a customer can use to redeem the discount.

•DiscountCombinesWith!
non-null

The discount classes that you can use in combination with Shopify discount types.

•DiscountContext!
non-null

The context defining which buyers can use the discount.

•DateTime!
non-null

The date and time when the discount was created.

•DiscountCustomerBuys!
non-null

The items eligible for the discount and the required quantity of each to receive the discount.

•DiscountCustomerGets!
non-null

The items in the order that qualify for the discount, their quantities, and the total value of the discount.

•[DiscountClass!]!
non-null

The classes of the discount.

•DateTime

The date and time when the discount expires and is no longer available to customers. For discounts without a fixed expiration date, specify null.

•Boolean!
non-null

Whether there are timeline comments associated with the discount.

•[DiscountShareableUrl!]!
non-null

A list of URLs that the app can use to share the discount.

•String!
non-null

An abbreviated version of the discount summary field.

•DateTime!
non-null

The date and time when the discount becomes active and is available to customers.

•DiscountStatus!
non-null

The status of the discount that describes its availability, expiration, or pending activation.

•String!
non-null

A detailed explanation of what the discount is, who can use it, when and where it applies, and any associated rules or limitations.

•String!
non-null

The discount's name that displays to merchants in the Shopify admin and to customers.

•MoneyV2

The total sales from orders where the discount was used.

•DateTime!
non-null

The date and time when the discount was updated.

•Int

The maximum number of times the discount can be redeemed. For unlimited usage, specify null.

•Int

The maximum number of times that the discount can be applied to an order.

Deprecated fields

•DiscountCustomerSelection!
non-nullDeprecated
•MerchandiseDiscountClass!
non-nullDeprecated

Was this section helpful?