Last active
September 11, 2023 17:02
-
-
Save JeroenSormani/c15ba6fdad7cd0c24bd9 to your computer and use it in GitHub Desktop.
Add a new action to the order action drop down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_order_actions', 'custom_wc_order_action', 10, 1 ); | |
function custom_wc_order_action( $actions ) { | |
if ( is_array( $actions ) ) { | |
$actions['custom_action'] = __( 'My custom action' ); | |
} | |
return $actions; | |
} | |
/** | |
* Filter name is woocommerce_order_action_{$action_slug} | |
*/ | |
add_action( 'woocommerce_order_action_custom_action', 'fired_my_custom_action' ); | |
function fired_my_custom_action( $order ) { | |
die( 'do my action ere' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment