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.


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


•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

•ID!
required

The ID of the automatic discount to update.

Anchor to automaticAppDiscountautomaticAppDiscount
•DiscountAutomaticAppInput!
required

The input fields required to update the automatic discount.


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


•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

•ID!
required

The ID of the automatic amount off discount to update.

Anchor to automaticBasicDiscountautomaticBasicDiscount
•DiscountAutomaticBasicInput!
required

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


•mutation

Deletes multiple automatic discounts in a single operation, providing efficient bulk management for stores with extensive discount catalogs. This mutation processes deletions asynchronously to handle large volumes without blocking other operations.

For example, when cleaning up expired seasonal promotions or removing outdated automatic discounts across product categories, merchants can delete dozens of discounts simultaneously rather than processing each individually.

Use DiscountAutomaticBulkDelete to:

  • Remove multiple automatic discounts efficiently
  • Clean up expired or obsolete promotions
  • Streamline discount management workflows
  • Process large-scale discount removals asynchronously

The operation returns a job object for tracking deletion progress and any validation errors encountered during processing.

Learn more about discount management.

Arguments

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

•ID

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

•[ID!]

The IDs of the automatic discounts to delete.


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


•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

•ID!
required

The ID of the automatic BXGY discount to update.

Anchor to automaticBxgyDiscountautomaticBxgyDiscount
•DiscountAutomaticBxgyInput!
required

The input data used to update the automatic BXGY discount.


•mutation

Deactivates an automatic discount.

Arguments

•ID!
required

The ID of the automatic discount to deactivate.


•mutation

Deletes an existing automatic discount from the store, permanently removing it from all future order calculations. This mutation provides a clean way to remove promotional campaigns that are no longer needed.

For example, when a seasonal promotion ends or a flash sale concludes, merchants can use this mutation to ensure the discount no longer applies to new orders while preserving historical order data.

Use DiscountAutomaticDelete to:

  • Remove expired promotional campaigns
  • Clean up test discounts during development
  • Delete automatic discounts that conflict with new promotions
  • Maintain a clean discount configuration

The mutation returns the ID of the deleted discount for confirmation and any validation errors if the deletion cannot be completed. Once deleted, the automatic discount will no longer appear in discount lists or apply to new customer orders.

Arguments

•ID!
required

The ID of the automatic discount to delete.


•mutation

Creates automatic free shipping discounts that apply to qualifying orders without requiring discount codes. These promotions automatically activate when customers meet specified criteria, streamlining the checkout experience.

For example, a store might create an automatic free shipping discount for orders over variable pricing to encourage larger purchases, or offer free shipping to specific customer segments during promotional periods.

Use DiscountAutomaticFreeShippingCreate to:

  • Set up code-free shipping promotions
  • Create order value-based shipping incentives
  • Target specific customer groups with shipping benefits
  • Establish location-based shipping discounts

The mutation validates discount configuration and returns the created automatic discount node along with any configuration errors that need resolution.

Learn more about automatic discounts.

Arguments

Anchor to freeShippingAutomaticDiscountfreeShippingAutomaticDiscount
•DiscountAutomaticFreeShippingInput!
required

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


•mutation

Updates existing automatic free shipping discounts, allowing merchants to modify promotion criteria, shipping destinations, and eligibility requirements without recreating the entire discount structure.

For example, extending a holiday free shipping promotion to include additional countries, adjusting the minimum order value threshold, or expanding customer eligibility to include new segments.

Use DiscountAutomaticFreeShippingUpdate to:

  • Modify shipping discount thresholds and criteria
  • Expand or restrict geographic availability
  • Update customer targeting and eligibility rules
  • Adjust promotion timing and activation periods

Changes take effect immediately for new orders, while the mutation validates all modifications and reports any configuration conflicts through user errors.

Learn more about managing automatic discounts.

Arguments

•ID!
required

The ID of the automatic free shipping discount to update.

Anchor to freeShippingAutomaticDiscountfreeShippingAutomaticDiscount
•DiscountAutomaticFreeShippingInput!
required

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


•mutation

Activates a previously created code discount, making it available for customers to use during checkout. This mutation transitions inactive discount codes into an active state where they can be applied to orders.

For example, after creating a "SUMMER20" discount code but leaving it inactive during setup, merchants can activate it when ready to launch their summer promotion campaign.

Use DiscountCodeActivate to:

  • Launch scheduled promotional campaigns
  • Reactivate previously paused discount codes
  • Enable discount codes after configuration changes
  • Control the timing of discount availability

The mutation returns the updated discount code node with its new active status and handles any validation errors that might prevent activation, such as conflicting discount rules or invalid date ranges.

Arguments

•ID!
required

The ID of the code discount to activate.


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


•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

•ID!
required

The ID of the discount to update.

•DiscountCodeAppInput!
required

The input fields required to update the discount.


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


•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

•ID!
required

The ID of the discount code to update.

•DiscountCodeBasicInput!
required

The input data used to update the discount code.


•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

•String

The search query for filtering discounts.

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

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

•[ID!]

The IDs of the discounts to activate.


•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

•String

The search query for filtering discounts.

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

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

•[ID!]

The IDs of the discounts to deactivate.


•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

•String

The search query for filtering discounts.

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

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

•[ID!]

The IDs of the discounts to delete.


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


•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

•ID!
required

The ID of the BXGY code discount to update.

•DiscountCodeBxgyInput!
required

The input data used to update the BXGY code discount.


•mutation

Temporarily suspends a code discount without permanently removing it from the store. Deactivation allows merchants to pause promotional campaigns while preserving the discount configuration for potential future use.

For example, when a flash sale needs to end immediately or a discount code requires temporary suspension due to inventory issues, merchants can deactivate it to stop new redemptions while keeping the discount structure intact.

Use DiscountCodeDeactivate to:

  • Pause active promotional campaigns timely
  • Temporarily suspend problematic discount codes
  • Control discount availability during inventory shortages
  • Maintain discount history while stopping usage

Deactivated discounts remain in the system and can be reactivated later, unlike deletion which persistently removes the code. Customers attempting to use deactivated codes will receive appropriate error messages.

Arguments

•ID!
required

The ID of the code discount to deactivate.


•mutation

Removes a code discount from the store, making it permanently unavailable for customer use. This mutation provides a clean way to eliminate discount codes that are no longer needed or have been replaced.

For example, when a seasonal promotion ends or a discount code has been compromised, merchants can delete it entirely rather than just deactivating it, ensuring customers cannot attempt to use expired promotional codes.

Use DiscountCodeDelete to:

  • persistently remove outdated promotional codes
  • Clean up discount code lists after campaigns end
  • Eliminate compromised or leaked discount codes
  • Maintain organized discount management

Once deleted, the discount code cannot be recovered and any customer attempts to use it will fail. This differs from deactivation, which preserves the code for potential future reactivation.

Arguments

•ID!
required

The ID of the code discount to delete.


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


•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

•ID!
required

The ID of the discount code to update.

Anchor to freeShippingCodeDiscountfreeShippingCodeDiscount
•DiscountCodeFreeShippingInput!
required

The input data used to update the discount code.


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

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

•ID

The ID of a saved search.

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


•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

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

•[DiscountRedeemCodeInput!]!
required

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



Was this section helpful?


Was this section helpful?