Filter uncanny-automator-pro

uap_wc_order_item_trigger_conditions

Filters WooCommerce Integrations' trigger conditions. Filters WooCommerce integration trigger conditions, allowing modification of action handles and labels.

add_filter( 'uap_wc_order_item_trigger_conditions', $callback, 10, 1 );

Description

This filter allows developers to customize the available trigger conditions for WooCommerce order items within Uncanny Automator Pro. Developers can add, remove, or modify the key-value pairs representing trigger hook handles and their human-readable labels, enabling fine-grained control over automations triggered by specific order events.


Usage

add_filter( 'uap_wc_order_item_trigger_conditions', 'your_function_name', 10, 1 );

Parameters

$trigger_conditions (array)
An array of key-value pairs of action hook handle and human readable label.

Return Value

The filtered value.


Examples

// Add a new trigger condition for when a WooCommerce order is refunded.
add_filter(
	'uap_wc_order_item_trigger_conditions',
	function ( $trigger_conditions ) {
		$trigger_conditions['woocommerce_order_refunded'] = esc_html_x( 'refunded', 'WooCommerce', 'uncanny-automator-pro' );
		return $trigger_conditions;
	},
	10, // Priority
	1   // Accepted args
);

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/integrations/woocommerce/helpers/woocommerce-pro-helpers.php:1051

public function get_order_item_trigger_condition_labels() {
		/**
		 * Filters WooCommerce Integrations' trigger conditions.
		 *
		 * @param array $trigger_conditions An array of key-value pairs of action hook handle and human readable label.
		 */
		return apply_filters(
			'uap_wc_order_item_trigger_conditions',
			array(
				'woocommerce_payment_complete'       => esc_html_x( 'paid for', 'WooCommerce', 'uncanny-automator-pro' ),
				'woocommerce_order_status_completed' => esc_html_x( 'completed', 'WooCommerce', 'uncanny-automator-pro' ),
				'woocommerce_thankyou'               => esc_html_x( 'thank you page visited', 'WooCommerce', 'uncanny-automator-pro' ),
			)
		);
	}


Scroll to Top