Skip to content

Instantly share code, notes, and snippets.

@JeroenSormani
Last active September 11, 2023 17:02
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JeroenSormani/c15ba6fdad7cd0c24bd9 to your computer and use it in GitHub Desktop.
Save JeroenSormani/c15ba6fdad7cd0c24bd9 to your computer and use it in GitHub Desktop.
Add a new action to the order action drop down
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