Skip to main content
All CollectionsTriggersAdvanced trigger control
Send or stop emails only during a set time period
Send or stop emails only during a set time period

You might want to send a trigger only within a set time period, to use a different email during a sale, for example.

Updated over 6 months ago

Itโ€™s possible to achieve this by switching over the email ID in the Send Email field on a trigger, however, a better option would be to setup two triggers and allow them to send based on the time the cart was abandoned.

Send only if a cart is created within specified date range

For the trigger you want to send during the event, use:

result.proceed = false;

var startDate = new Date('2013-10-09 00:00:00 UTC');

var endDate = new Date('2013-10-09 23:59:59 UTC');

if (cart.dt >= startDate && cart.dt <= endDate) { result.proceed = true; }

Change the startDate and endDate variables to match the date and time of the period you want to send the emails for.

Stop send if a cart is created time within specified date range

For the trigger you want to stop during an event, use the following:

result.proceed = true;

var startDate = new Date('2013-10-09 00:00:00 UTC');

var endDate = new Date('2013-10-09 23:59:59 UTC');

if (cart.dt >= startDate && cart.dt <= endDate) { result.proceed = false; }

These times must be for the UTC time zone (otherwise know as GMT). So, you need to work out the start and end times in UTC compared to your time zone โ€” you must also account for Daylight Savings/Summertime).

For example, if you were based in Miami and had a sale that ran on 9th October 2013 you would have been in Eastern Daylight Time (EDT), which is four hours behind (compared to EST, which is five), so:

Miami (EDT)

UTC

Start Date

2013-10-09 00:00:00

2013-10-09 04:00:00

End Date

2013-10-09 23:59:59

2013-10-10 03:59:59

You can find the current UTC time here and here's an online time zone converter.

Did this answer your question?