Load custom order actions for workflows

Custom order actions must be registered during non-admin requests too. The first example loads them only before AutomateWoo’s Trigger Order Action runs; the second loads them before any workflow. Replace the two placeholder functions with your plugin’s registration functions.

Developer note:

Add custom PHP in a small custom plugin or child theme, and test it on a staging site before production. This example requires ongoing maintenance when extension APIs change.

Load only for Trigger Order Action

<?php

add_action( 'automatewoo_before_action_run', 'my_store_load_order_actions_for_automatewoo' );

/**
 * Load custom order actions before Trigger Order Action runs.
 *
 * @param AutomateWoo\Action $action Current action.
 */
function my_store_load_order_actions_for_automatewoo( $action ) {
	if ( 'trigger_order_action' !== $action->get_name() ) {
		return;
	}

	if ( ! my_store_has_registered_order_actions() ) {
		my_store_register_order_actions();
	}
}

Load before every workflow

<?php

add_action( 'automatewoo/workflow/before_run', 'my_store_load_order_actions_for_workflows' );

/**
 * Load custom order actions before any workflow runs.
 */
function my_store_load_order_actions_for_workflows() {
	if ( ! my_store_has_registered_order_actions() ) {
		my_store_register_order_actions();
	}
}
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.