Discounts with different expiry dates but Same price rule

Hi,

Case:

For example, I defined a price rule and the expiry of that rule is 30 days.

we can create different discount codes and assign them to this price rule.

For instance, if we assign 5 discounts on the first day their expiration time will be 30 days.

And If we assign 5 new discounts after 5 days. They will be expired in 25 days.

And all of these discount codes will expire once the price rule will be expired.

Question:

Is it possible to set the expiration time of every discount whenever a new discount is assigned to the price rule?

For example, if we assign 5 discounts on the first day their expiration time will be 30 days.

And If we assign 5 new discounts after 5 days. Their expiration should also be 30 days.

Thanks & Regards

Hey @mbila4670, thanks for reaching out - at the moment it’s not possible to set separate expiry dates for discount codes as a lot of the logic for each code is handled by the price rule. The discount code resource is essentially a data structure that contains the name of the code, and some analytical data/metadata (like its related Price Rule ID and a use counter). There’s a bit more information in our dev docs here.

Hope this helps!

1 Like

Hi,

Thanks for the quick reply.

Is there any workaround in order to achieve this?

Thanks & Regards

Hi mbilal4670,

A workaround could be to create a separate price rule for each different expiry date that is required, or depending on the use case maybe creating each discount individually using the [discountCodeBasicCreate] mutation where the endsAt date is specified for each code.

A current guide about creating discount codes via API is here [Create code discounts in GraphQL - Shopify Dev Docs]