Advanced time delaying for your actions
There may be a situation when you need to delay an action for a specific time, like scheduling it for a special sale date or just prevent customers' mailboxes from overflowing with your messages by slightly delaying them from the moment an event occurs. This is where the ShopMagic Delayed Actions add-on comes in handy.
How to postpone your actions?
After plugin activation, your automations will now have an additional checkbox in action configuration - Enable delay. This is the only configuration you need for delaying actions. Additionally, each of your actions is postponed on its own configuration, so you can mix multiple actions with delay for one automation, e.g. a series of payment reminders deferred for one hour, a week, and two weeks with rechecking order status before running action.
Available types of delay
ShopMagic Delayed Actions introduces 4 different types of deferring:
- Simple time delay
- Run on a fixed date
- Schedule with time
- Delay with placeholder
In addition to that, you can prevent your emails from sending e.g. on weekends by selecting Active days.
Running on a fixed date, scheduling with time, and selecting available days is possible since ShopMagic Delayed Actions 3.0
Simple time delay
When you just want to suspend your action for a specified time, e.g. 2 hours since a new order was made, this setting is the best solution. You can select to delay your action by a specified number of:
- minutes
- hours
- days
- weeks
Run on a fixed date
When you are going to start a special sale starting next Friday at 5 o'clock, there's no better possibility than scheduling your action for a specific date. You can plan ahead when your actions are needed to run and don't bother anymore. All automations occurring before the date of schedule will be queued.
When the time of your schedule passes, no more automations will be executed, yet outcomes will show failed action, which is past the schedule. It's a good idea to clean up overdue automations.
Schedule with time
There are moments when you don't have any specific date in mind, but you'd rather not email your customer in the middle of the night. With selecting time of delay, you can ensure, automations are executed no more than once a day on the selected hour.
This setting plays nicely with the Active days setting, allowing you to configure action execution no more often than once a week. Selecting only one active day will schedule your actions for the next selected day.
Delay with placeholder
Delaying with placeholders is possibly the most powerful setting for special use cases, thanks to the underlying mechanism of the PHP language. Our date related placeholders can be referenced here with specific time modifications, based on PHP documentation for relative date formats.
Placeholders, you can use in these settings:
{{ order.date_created }}
{{ order.date_completed }}
{{ order.date_paid }}
{{ membership.expires_date }}
{{ membership.started_date }}
{{ subscriptions.end_date }}
{{ subscriptions.last_payment_date }}
{{ subscriptions.next_payment_date }}
{{ subscriptions.start_date }}
{{ subscriptions.trial_end_date }}
{{ booking.end_date }}
{{ booking.start_date }}
Advanced usage of placeholders for delay
Besides the above placeholders, you can also rely on any meta fields stored with your order, product, or subscription, etc. (with correct usage i.e. no subscription data is stored in an order-based event). The only requirement is that the placeholder returns a date parsable by the PHP DateTime
class constructor, according to PHP supported date and time formats. This enables you a world of possibilities, as your meta field can contain values such as first day of next month or similar complex formats.
Save the day with active days setting
Each of your delays can be configured further with an addition of active days checkboxes: you can select which days are available for executing an action. The way it works is simple - if your schedule is set for any day that falls into not-checked days, it will be rescheduled for the first available day. In such case, if you've checked the time delay for 2 hours, but the automation is executed on Saturday (which is disabled at your current settings), the action will be planned for Monday (the next available).
Selecting days have the highest priority of scheduling, meaning when you set any delay, it will find the next active day before planning. This may lead to a quirk when you use Run on a fixed date - if the day of the schedule is one of the disabled days, your automation will be scheduled for the next selected day, instead of the specific date set.
With the selection of specified days, you can create such configurations as sending emails with coupons to your customers only on business days.
How to check scheduled actions?
All delayed actions are put into the queue, which you can find in your admin area (ShopMagic → Queue). The queue has info about the name of the scheduled action and the time of execution. Additionally, you are able to cancel any action from the queue, if you don't want to run it.
When the scheduled time comes, the action will be executed, and you will be able to see its outcome in another tab - ShopMagic → Outcomes.