DiscountCode

This page was printed on Mar 21, 2019. For the current version, visit https://help.shopify.com/en/api/reference/discounts/discountcode.

You can use the PriceRule DiscountCode resource to create discount codes that enable specific discounts to be redeemed.
Merchants can distribute discount codes to their customers using a variety of means, such as an email or URL, and customers can apply these codes at checkout.

Each discount code belongs to a price rule, which holds the logic for the discount. For more information, see the PriceRule resource.

To create multiple discount codes that use the same price rule logic, use the batch endpoint. For example, you might allow merchants to create a batch of discount codes that belong to the same price rule but are each personalized for a different customer.

What you can do with DiscountCode

The Shopify API lets you do the following with the DiscountCode resource. More detailed versions of these general actions may be available:

The discount code's location is returned in the location header, not in the DiscountCode object itself.
Depending on your HTTP client, the location of the discount code might follow the location header automatically.