Skip to main content
object

An error that occurs during the execution of a discount mutation.

•DiscountErrorCode

The error code.

•String

Extra information about this error.

•[String!]

The path to the input field that caused the error.

•String!non-null

The error message.


Was this section helpful?

•mutation

Activates an automatic discount.

Arguments

•ID!required

The ID of the automatic discount to activate.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The activated automatic discount.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates an automatic discount that's managed by an app. Use this mutation with Shopify Functions when you need advanced, custom, or dynamic discount capabilities that aren't supported by Shopify's native discount types.

For example, use this mutation to create an automatic discount using an app's "Volume" discount type that applies a percentage off when customers purchase more than the minimum quantity of a product. For an example implementation, refer to our tutorial.


Note

To create code discounts with custom logic, use the discountCodeAppCreate mutation.


Arguments

Anchor to automaticAppDiscountautomaticAppDiscount
•DiscountAutomaticAppInput!required

The input data used to create the automatic discount.


Fields

Anchor to automaticAppDiscountautomaticAppDiscount
•DiscountAutomaticApp

The automatic discount that the app manages.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates an existing automatic discount that's managed by an app using Shopify Functions. Use this mutation when you need advanced, custom, or dynamic discount capabilities that aren't supported by Shopify's native discount types.

For example, use this mutation to update a new "Volume" discount type that applies a percentage off when customers purchase more than the minimum quantity of a product. For an example implementation, refer to our tutorial.


Note

To update code discounts with custom logic, use the discountCodeAppUpdate mutation instead.


Arguments

Anchor to automaticAppDiscountautomaticAppDiscount
•DiscountAutomaticAppInput!required

The input fields required to update the automatic discount.

•ID!required

The ID of the automatic discount to update.


Fields

Anchor to automaticAppDiscountautomaticAppDiscount
•DiscountAutomaticApp

The updated automatic discount that the app provides.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates an amount off discount that's automatically applied on a cart and at checkout.


Note

To create code discounts, use the discountCodeBasicCreate mutation.


Arguments

Anchor to automaticBasicDiscountautomaticBasicDiscount
•DiscountAutomaticBasicInput!required

The input data used to create the automatic amount off discount.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic discount that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates an existing amount off discount that's automatically applied on a cart and at checkout.


Note

To update code discounts, use the discountCodeBasicUpdate mutation instead.


Arguments

Anchor to automaticBasicDiscountautomaticBasicDiscount
•DiscountAutomaticBasicInput!required

The input data used to update the automatic amount off discount.

•ID!required

The ID of the automatic amount off discount to update.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic discount that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Asynchronously delete automatic discounts in bulk if a search or saved_search_id argument is provided or if a maximum discount threshold is reached (1,000). Otherwise, deletions will occur inline. Warning: All automatic discounts will be deleted if a blank search argument is provided.

Arguments

•[ID!]

The IDs of the automatic discounts to delete.

•ID

The ID of the saved search to use for filtering automatic discounts to delete.

•String

The search query for filtering automatic discounts to delete.

For more information on the list of supported fields and search syntax, refer to the AutomaticDiscountNodes query section.


Fields

•Job

The asynchronous job removing the automatic discounts.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates a buy X get Y discount (BXGY) that's automatically applied on a cart and at checkout.


Note

To create code discounts, use the discountCodeBxgyCreate mutation.


Arguments

Anchor to automaticBxgyDiscountautomaticBxgyDiscount
•DiscountAutomaticBxgyInput!required

The input data used to create the automatic BXGY discount.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic discount that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates an existing buy X get Y discount (BXGY) that's automatically applied on a cart and at checkout.


Note

To update code discounts, use the discountCodeBxgyUpdate mutation instead.


Arguments

Anchor to automaticBxgyDiscountautomaticBxgyDiscount
•DiscountAutomaticBxgyInput!required

The input data used to update the automatic BXGY discount.

•ID!required

The ID of the automatic BXGY discount to update.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic discount that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deactivates an automatic discount.

Arguments

•ID!required

The ID of the automatic discount to deactivate.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The deactivated automatic discount.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deletes an automatic discount.

Arguments

•ID!required

The ID of the automatic discount to delete.


Fields

Anchor to deletedAutomaticDiscountIddeletedAutomaticDiscountId
•ID

The ID of the automatic discount that was deleted.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates a free shipping discount that's automatically applied on a cart and at checkout.


Note

To create code discounts, use the discountCodeFreeShippingCreate mutation.


Arguments

Anchor to freeShippingAutomaticDiscountfreeShippingAutomaticDiscount
•DiscountAutomaticFreeShippingInput!required

The input data used to create the automatic free shipping discount.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic free shipping discount that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates an existing free shipping discount that's automatically applied on a cart and at checkout.


Note

To update code discounts, use the discountCodeFreeShippingUpdate mutation instead.


Arguments

Anchor to freeShippingAutomaticDiscountfreeShippingAutomaticDiscount
•DiscountAutomaticFreeShippingInput!required

The input data used to update the automatic free shipping discount.

•ID!required

The ID of the automatic free shipping discount to update.


Fields

Anchor to automaticDiscountNodeautomaticDiscountNode
•DiscountAutomaticNode

The automatic discount that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Activates a code discount.

Arguments

•ID!required

The ID of the code discount to activate.


Fields

•DiscountCodeNode

The activated code discount.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates a code discount. The discount type must be provided by an app extension that uses Shopify Functions. Functions can implement order, product, or shipping discount functions. Use this mutation with Shopify Functions when you need custom logic beyond Shopify's native discount types.

For example, use this mutation to create a code discount using an app's "Volume" discount type that applies a percentage off when customers purchase more than the minimum quantity of a product. For an example implementation, refer to our tutorial.


Note

To create automatic discounts with custom logic, use discountAutomaticAppCreate.


Arguments

•DiscountCodeAppInput!required

The input data used to create the discount.


Fields

•DiscountCodeApp

The discount that the app provides.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates a code discount, where the discount type is provided by an app extension that uses Shopify Functions. Use this mutation when you need advanced, custom, or dynamic discount capabilities that aren't supported by Shopify's native discount types.


Note

To update automatic discounts, use discountAutomaticAppUpdate.


Arguments

•DiscountCodeAppInput!required

The input fields required to update the discount.

•ID!required

The ID of the discount to update.


Fields

•DiscountCodeApp

The updated discount that the app provides.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

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


Note

To create discounts that are automatically applied on a cart and at checkout, use the discountAutomaticBasicCreate mutation.


Arguments

•DiscountCodeBasicInput!required

The input data used to create the discount code.


Fields

•DiscountCodeNode

The discount code that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

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


Note

To update discounts that are automatically applied on a cart and at checkout, use the discountAutomaticBasicUpdate mutation.


Arguments

•DiscountCodeBasicInput!required

The input data used to update the discount code.

•ID!required

The ID of the discount code to update.


Fields

•DiscountCodeNode

The discount code that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Activates multiple code discounts asynchronously using one of the following:

  • A search query
  • A saved search ID
  • A list of discount code IDs

For example, you can activate discounts for all codes that match a search criteria, or activate a predefined set of discount codes.

Arguments

•[ID!]

The IDs of the discounts to activate.

•ID

The ID of the saved search for filtering discounts to activate. Saved searches represent customer segments that merchants have built in the Shopify admin.

•String

The search query for filtering discounts.

For more information on the list of supported fields and search syntax, refer to the codeDiscountNodes query.


Fields

•Job

The asynchronous job that activates the discounts.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deactivates multiple code-based discounts asynchronously using one of the following:

  • A search query
  • A saved search ID
  • A list of discount code IDs

For example, you can deactivate discounts for all codes that match a search criteria, or deactivate a predefined set of discount codes.

Arguments

•[ID!]

The IDs of the discounts to deactivate.

•ID

The ID of the saved search for filtering discounts to deactivate. Saved searches represent customer segments that merchants have built in the Shopify admin.

•String

The search query for filtering discounts.

For more information on the list of supported fields and search syntax, refer to the codeDiscountNodes query.


Fields

•Job

The asynchronous job that deactivates the discounts.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deletes multiple code-based discounts asynchronously using one of the following:

  • A search query
  • A saved search ID
  • A list of discount code IDs

For example, you can delete discounts for all codes that match a search criteria, or delete a predefined set of discount codes.

Arguments

•[ID!]

The IDs of the discounts to delete.

•ID

The ID of the saved search for filtering discounts to delete. Saved searches represent customer segments that merchants have built in the Shopify admin.

•String

The search query for filtering discounts.

For more information on the list of supported fields and search syntax, refer to the codeDiscountNodes query.


Fields

•Job

The asynchronous job that deletes the discounts.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.


Note

To create discounts that are automatically applied on a cart and at checkout, use the discountAutomaticBxgyCreate mutation.


Arguments

•DiscountCodeBxgyInput!required

The input data used to create the BXGY code discount.


Fields

•DiscountCodeNode

The code discount that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.


Note

To update discounts that are automatically applied on a cart and at checkout, use the discountAutomaticBxgyUpdate mutation.


Arguments

•DiscountCodeBxgyInput!required

The input data used to update the BXGY code discount.

•ID!required

The ID of the BXGY code discount to update.


Fields

•DiscountCodeNode

The code discount that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deactivates a code discount.

Arguments

•ID!required

The ID of the code discount to deactivate.


Fields

•DiscountCodeNode

The deactivated code discount.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Deletes a code discount.

Arguments

•ID!required

The ID of the code discount to delete.


Fields

Anchor to deletedCodeDiscountIddeletedCodeDiscountId
•ID

The ID of the code discount that was deleted.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Creates an free shipping discount that's applied on a cart and at checkout when a customer enters a code.


Note

To create discounts that are automatically applied on a cart and at checkout, use the discountAutomaticFreeShippingCreate mutation.


Arguments

Anchor to freeShippingCodeDiscountfreeShippingCodeDiscount
•DiscountCodeFreeShippingInput!required

The input data used to create the discount code.


Fields

•DiscountCodeNode

The discount code that was created.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Updates a free shipping discount that's applied on a cart and at checkout when a customer enters a code.


Note

To update a free shipping discount that's automatically applied on a cart and at checkout, use the discountAutomaticFreeShippingUpdate mutation.


Arguments

Anchor to freeShippingCodeDiscountfreeShippingCodeDiscount
•DiscountCodeFreeShippingInput!required

The input data used to update the discount code.

•ID!required

The ID of the discount code to update.


Fields

•DiscountCodeNode

The discount code that was updated.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Asynchronously delete discount codes in bulk that customers can use to redeem a discount.

Arguments

•ID!required

The ID of the DiscountCodeNode object that the codes will be removed from. For example, gid://shopify/DiscountCodeNode/123. You can use the codeDiscountNodes query to retrieve the ID.

•[ID!]

The IDs of the DiscountRedeemCode objects to delete. For example, gid://shopify/DiscountRedeemCode/123. You can use the codeDiscountNodes query to retrieve the ID.

•ID

The ID of a saved search.

•String

A filter made up of terms, connectives, modifiers, and comparators that you can use to search for code discounts. You can apply one or more filters to a query. Learn more about Shopify API search syntax.

For a list of accepted values for the search field, refer to the query argument on the codeDiscountNodes query.


Fields

•Job

The asynchronous job that deletes the discount codes.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.

•mutation

Asynchronously add discount codes in bulk that customers can use to redeem a discount. You can use the discountRedeemCodeBulkAdd mutation to automate the distribution of discount codes through emails or other marketing channels.

Arguments

•[DiscountRedeemCodeInput!]!required

The list of codes to associate with the code discount. Maximum: 250 codes.

•ID!required

The ID of the DiscountCodeNode object that the codes will be added to. For example, gid://shopify/DiscountCodeNode/123. You can use the codeDiscountNodes query to retrieve the ID.


Fields

•DiscountRedeemCodeBulkCreation

The ID of bulk operation that creates multiple unique discount codes. You can use the discountRedeemCodeBulkCreation query to track the status of the bulk operation.

•[DiscountUserError!]!non-null

The list of errors that occurred from executing the mutation.


Was this section helpful?


Was this section helpful?