1. Documentation /
  2. AutomateWoo /
  3. Asynchronous events

Asynchronous events

AutomateWoo processes many triggers asynchronously by using asynchronous events. Such events are separated from the main event and slightly delayed.

Prior to AutomateWoo 4.8, these async events would always be temporarily stored in the database and run in the background. This happened regardless of whether they were being used or not.

AutomateWoo 4.8 introduces a number of optimizations to how the async events system works. The main difference is that async events will now only run if the site has an active workflow that requires the event.

Let’s say your site isn’t using the Customer Account Created trigger. In that case, AutomateWoo will no longer create an async event when a customer creates an account.

Implications for custom triggers

↑ Back to top

Each workflow’s required async events are set by the workflow’s trigger. This means that custom triggers must declare which async events they require if they are triggered by an async event hook.

One example of this is the Order Paid trigger which is initiated by the WordPress action automatewoo/order/paid_async. This is an async event. It is fired asynchronously by being stored in the database and run shortly after the original order paid event happens. Therefore the Order Paid trigger must declare that it requires the order_paid async event.

An async event requirement is declared on a trigger with the $required_async_events property as shown in the code example below.

How do I know if my trigger requires an async event?

↑ Back to top

If your trigger uses any of the async action hooks that are listed below you will need to add the event name to the $required_async_events property of that trigger.

List of async events

↑ Back to top

The following is a list of async event names with their corresponding WordPress actions.

  • order_created : automatewoo/async/order_created
  • order_status_changed: automatewoo/order/status_changed_async
  • order_paid: automatewoo/order/paid_async
  • order_pending: automatewoo_order_pending
  • review_approved: automatewoo/review/posted_async
  • user_registered: automatewoo/async/user_registered
  • subscription_created: automatewoo/async/subscription_created
  • subscription_status_changed: automatewoo/subscription/status_changed_async
  • subscription_renewal_payment_complete: automatewoo/subscription/renewal_payment_complete_async
  • subscription_renewal_payment_failed: automatewoo/subscription/renewal_payment_failed_async
  • membership_status_changed: automatewoo/membership_status_changed_async
  • mc4wp_form_success: automatewoo/mc4wp_form_success_async

Custom trigger example using an existing async event

↑ Back to top