Skip to content

Instantly share code, notes, and snippets.

@jgarciaruiz
Last active October 25, 2016 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarciaruiz/c4ad468ee89ab077332d1845b5c78457 to your computer and use it in GitHub Desktop.
Save jgarciaruiz/c4ad468ee89ab077332d1845b5c78457 to your computer and use it in GitHub Desktop.
WooCommerce Add custom Order actions to Order action meta box
<?php
/*
* WC - Add custom Order actions to Order action meta box
*********************************************************** */
add_action('woocommerce_order_actions', 'custom_wc_order_action', 10, 1 );
function custom_wc_order_action( $actions ) {
if ( is_array( $actions ) ) {
$actions['custom_action_one'] = __( 'My custom action One' );
$actions['custom_action_two'] = __( 'My custom action Two' );
}
return $actions;
}
//Filter name is woocommerce_order_action_{$action_slug}
add_action( 'woocommerce_order_action_custom_action_one', 'my_custom_actionOne' );
function my_custom_actionOne( $order ) {
//...
}
//Filter name is woocommerce_order_action_{$action_slug}
add_action( 'woocommerce_order_action_custom_action_two', 'my_custom_actionTwo' );
function my_custom_actionTwo( $order ) {
//...
}
?>
@jgarciaruiz
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment