Discount Code Node
Requires Apps must have access scope.
The object enables you to manage code discounts that are applied when customers enter a code at checkout. For example, 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. Or, you can offer discounts where customers have to enter a code to get free shipping. Merchants can create and share discount codes individually with customers.
Learn more about working with Shopify's discount model, including related queries, mutations, limitations, and considerations.
Anchor to Fields and connectionsFields and connections
- Anchor to codeDiscountcode•Discount
Discount Code!non-null The underlying code discount object.
- Anchor to eventsevents•Event
Connection!non-null The paginated list of events associated with the host subject.
- •ID!non-null
A globally-unique ID.
- Anchor to metafieldmetafield•Metafield
A custom field, including its
namespace
andkey
, that's associated with a Shopify resource for the purposes of adding and storing additional information.- Anchor to metafieldsmetafields•Metafield
Connection!non-null A list of custom fields that a merchant associates with a Shopify resource.
- Anchor to metafieldsByIdentifiersmetafields•[Metafield]!non-null
By Identifiers The metafields associated with the resource matching the supplied list of namespaces and keys.
- Anchor to metafieldDefinitionsmetafield•Metafield
Definitions Definition Connection!non-nullDeprecated
Anchor to QueriesQueries
- •query
Returns a code discount resource by ID.
- •query
Returns a code discount identified by its discount code.
- •query
Returns a list of code-based discounts.
Anchor to MutationsMutations
- •mutation
Activates a code discount.
- •ID!required
The ID of the code discount to activate.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The activated code discount.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Creates an amount off discount that's applied on a cart and at checkout when a customer enters a code. Amount off discounts can be a percentage off or a fixed amount off.
- Anchor to basicCodeDiscountbasic•Discount
Code Discount Code Basic Input!required The input data used to create the discount code.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The discount code that was created.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Updates an amount off discount that's applied on a cart and at checkout when a customer enters a code. Amount off discounts can be a percentage off or a fixed amount off.
- Anchor to basicCodeDiscountbasic•Discount
Code Discount Code Basic Input!required The input data used to update the discount code.
- •ID!required
The ID of the discount code to update.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The discount code that was updated.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Creates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.
- Anchor to bxgyCodeDiscountbxgy•Discount
Code Discount Code Bxgy Input!required The input data used to create the BXGY code discount.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The code discount that was created.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Updates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.
- Anchor to bxgyCodeDiscountbxgy•Discount
Code Discount Code Bxgy Input!required The input data used to update the BXGY code discount.
- •ID!required
The ID of the BXGY code discount to update.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The code discount that was updated.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Deactivates a code discount.
- •ID!required
The ID of the code discount to deactivate.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The deactivated code discount.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Creates an free shipping discount that's applied on a cart and at checkout when a customer enters a code.
- Anchor to freeShippingCodeDiscountfree•Discount
Shipping Code Discount Code Free Shipping Input!required The input data used to create the discount code.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The discount code that was created.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields
- •mutation
Updates a free shipping discount that's applied on a cart and at checkout when a customer enters a code.
Note- Anchor to freeShippingCodeDiscountfree•Discount
Shipping Code Discount Code Free Shipping Input!required The input data used to update the discount code.
- •ID!required
The ID of the discount code to update.
Arguments
- Anchor to codeDiscountNodecode•Discount
Discount Node Code Node The discount code that was updated.
- Anchor to userErrorsuser•[Discount
Errors User Error!]!non-null The list of errors that occurred from executing the mutation.
Fields