Last active
October 25, 2016 13:11
-
-
Save jgarciaruiz/c4ad468ee89ab077332d1845b5c78457 to your computer and use it in GitHub Desktop.
WooCommerce Add custom Order actions to Order action meta box
This file contains 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
<?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 ) { | |
//... | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related with https://gist.github.com/jgarciaruiz/098e3a5f40f22fab04242b4ea41366c3