Discount User Error
An error that occurs during the execution of a discount mutation.
Anchor to FieldsFields
- Anchor to codecode•Discount
Error Code The error code.
- Anchor to extraInfoextra•String
Info Extra information about this error.
- Anchor to fieldfield•[String!]
The path to the input field that caused the error.
- Anchor to messagemessage•String!non-null
The error message.
Anchor to MutationsMutations
- •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.
- •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.
- •mutation
- •mutation
- •mutation
Asynchronously delete automatic discounts in bulk if a
search
orargument 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
- •mutation
Updates an existing buy X get Y discount (BXGY) that's automatically applied on a cart and at checkout.
- •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
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
- •mutation
- •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
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.
- •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.
- •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.
- •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.
- •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.
- •mutation
Updates a buy X get Y discount (BXGY) that's applied on a cart and at checkout when a customer enters a code.
- •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
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
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.
- •mutation
Updates a free shipping discount that's applied on a cart and at checkout when a customer enters a code.
Note- •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
mutation to automate the distribution of discount codes through emails or other marketing channels.