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.

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


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


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


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


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

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


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


•mutation

Deactivates an automatic discount.

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

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


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


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

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


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


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


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


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

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

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

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


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


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

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

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


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


•mutation

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

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


Was this section helpful?


Was this section helpful?