How to create a segment for a promotional code with an expire date in 3 days after sent email?

Hello all,

Been trying to find a way to do what i said above.
I come with this

number_of_orders = 0
AND abandoned_checkout_date >= -30d
AND storefront.product_viewed(since: -30d) = true
AND (current_date <= email_sent_date + 3d)

is this possible? I’m trying to find a way with a static code, but setting it expire date after customer receives a email with the said code.

Yes, you can achieve this by implementing logic to check the conditions in your code. Here’s a short example in pseudocode

if number_of_orders == 0 and
abandoned_checkout_date >= current_date - 30 days and
storefront.product_viewed(since: current_date - 30 days) and
current_date <= email_sent_date + 3 days:

Send discount code or perform the desired action

Thank you! Sorry for the late reply, i will test this out and will update you on this matter. once again thank :grinning_face_with_smiling_eyes: