Scheduling actions

Since version 2.1 ShopMagic utilizes Action Scheduler to process all actions triggered by events in WooCommerce. This means that when the event occurs (i.e. the order is placed), the action (i.e. sending customer email) is added to the Action Scheduler queue and is slightly delayed.

We decided to use Action Scheduler to get a better reliability and speed up WooCommerce events, for example checkout process or order fulfillment. However this means that the actions will be processed with a slight delay when they get through the Action Scheduler process.

This delay will be less than a minute, but can also result in longer time depending on your WP-Cron configuration.

Skipping the queue

Although this delay is small, in certain events this can still cause some user concerns. For example user registration or some other transactional events.

That's why we've also prepared a filter that you can use to skip the queue and process the actions immediately when the event happens. For all or selected events according to your needs.

All events

In order to skip the queue for all events and perform the actions immediately use the following code:

add_filter( 'shopmagic/core/queue/avoid_queue', '__return_true' );

Specific automation

The following example will skip the queue for automation with ID 99. Replace "99" with your automation ID.

add_filter( 'shopmagic/core/queue/avoid_queue', 'sm_avoid_queue_for_automation', 10, 2 );
 * Skip ShopMagic queue for specific automation
 * @param $avoid_queue
 * @param $automation
 * @return bool
function sm_avoid_queue_for_automation( $avoid_queue, $automation ) {

   $automation_id = 99; // Replace 99 with your automation ID

   if ( $automation->get_id() === $automation_id ) {
      return true;

   return $avoid_queue;

You can find your automation ID in the URL when you edit it.

How to find automation ID

Specific events/actions

We will provide these code examples in future.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us