Solved

Discounts with different expiry dates but Same price rule

mbilal4670
Shopify Partner
3 0 0

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

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1440 235 489

This is an accepted solution.

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!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1440 235 489

This is an accepted solution.

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!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

mbilal4670
Shopify Partner
3 0 0

Hi,

 

Thanks for the quick reply.

 

Is there any workaround in order to achieve this? 

 

Thanks & Regards

ShopifyDevSup
Shopify Staff
1440 235 489

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]

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog