Skip to content

Instantly share code, notes, and snippets.

@jgarciaruiz
Last active Oct 25, 2016
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@jgarciaruiz jgarciaruiz commented Oct 25, 2016

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