How to use the advanced settings for Shopify codes
If you need to specify more advanced settings for generating your discount codes, you can use the Advanced settings dialogue. This allows you to specify all properties available in Shopify's API. This is an advanced setting and requires that you perform tests to make sure that the codes are generated correctly.
Examples of what you can do
- Set a fixed expiry date for generated codes
- Only allow the discount to work on specific collections, products, or variants
- Require a minimum subtotal on the order
Set a fixed expiry date for generated codes
To override the regular expiry date settings (where you specify the number of hours to expiry), you can add the "ends_at" property to the advanced settings. This property accepts a fixed date when the generated code should expire. Here's an example of this added:
Only allow the discount to work on specific collections, products, or variants
Use the "entitled_collection_ids", "entitled_product_ids", or "entitled_variant_ids" properties to specify one or more collections/products/variants that the discounts will be entitled to. For all three types, you'll need to set the correct target_type and target_selection as shown below.
In this example, we'll use "entitled_collection_ids". To set this property, you enter the collection ID(s): "entitled_collection_ids":  or if you have multiple: "entitled_collection_ids": [12345, 6789]
You can find the collection ID by browsing to the collection in your Shopify admin portal where you can see the collection ID in the URL:
According to the Shopify documentation on this property, you also need to specify "target_type" and "target_selection" if you decide to use "entitled_collection_ids". The three properties you need to change are the following:
" entitled_collection_ids": .
Here's how it would look in the advanced settings:
Require a minimum subtotal on the order
You can use the "prerequisite_subtotal_range" property to set a minimum order value that's required for the discount to be applicable. Here's an example: