Table of Contents
Developer hooks and filters reference #
This reference lists the filters exposed by Automated Stock Update Triggers for WooCommerce so you can extend or override its behavior in code. All examples go in your child theme’s functions.php or a small custom plugin.
Filters #
| Filter | Purpose | Arguments |
|---|---|---|
alg_wc_stock_triggers_list |
The full list of available triggers (keyed by action hook name). Pro uses this to add every registered order status. | $triggers (array) |
alg_wc_stock_triggers_section_triggers |
The active triggers for one section before they are hooked. Pro uses this to merge in custom triggers. | $triggers (array), $section_id (decrease or increase) |
alg_wc_stock_triggers_order_status_list |
The status choices for the Admin “Adjust line item product stock” option. Pro uses this to add all order statuses. | $statuses (array) |
alg_wc_stock_triggers_function_decrease |
The function called to decrease stock. Return a different callable to change how stock is reduced. | $func (default wc_maybe_reduce_stock_levels), $order_id |
alg_wc_stock_triggers_function_increase |
The function called to increase stock. Return a different callable to change how stock is restored. | $func (default wc_maybe_increase_stock_levels), $order_id |
alg_wc_stock_triggers_settings |
Internal Pro gate. Controls the read-only state of the Custom triggers field and the free-version upsell text. Not intended as a public extension point. | $value, $type, $args |
Example: add a custom action as an available trigger #
add_filter( 'alg_wc_stock_triggers_list', function ( $triggers ) {
$triggers['my_custom_stock_action'] = __( 'My custom stock action', 'my-textdomain' );
return $triggers;
} );
Example: add a trigger to the decrease section in code #
add_filter( 'alg_wc_stock_triggers_section_triggers', function ( $triggers, $section_id ) {
if ( 'decrease' === $section_id ) {
$triggers[] = 'woocommerce_order_status_completed';
}
return $triggers;
}, 10, 2 );
Example: force a hard stock reduction instead of “maybe” #
add_filter( 'alg_wc_stock_triggers_function_decrease', function ( $func, $order_id ) {
return 'wc_reduce_stock_levels'; // always reduce, ignoring the already-reduced guard
}, 10, 2 );
Note on naming #
All option keys and hooks use the historical alg_wc_stock_triggers_ prefix. These are current, not deprecated. The developer filters alg_wc_stock_triggers_function_decrease and alg_wc_stock_triggers_function_increase were added in version 1.6.3.
Need a hand? #
For integration questions, our team answers through the Stock Triggers support page.