I would like to add a meta box in the manual admin orders page of woocommerce.
This meta box will need to be a checkbox that if selected triggers an action
so far from what i have read it will need to start something like this
function add_meta_boxes()
{
add_meta_box(
'Meta Box', // ID, should be a string.
'woocommerce-action-trigger', // Meta Box Title.
'my_meta_box', // Your call back function, this is where your form field will go.
'shop_order', // The post type you want this to show up on, can be post, page, or custom post type.
'side', // The placement of your meta box, can be normal or side.
'default' // The priority in which this will be displayed.
);
}
Then i need a form that if admin selects will trigger an action
function triggeraction_meta_box() {
$checkboxMeta = make_action_happen();
}
<input type="checkbox" name="action" id="action" value="yes" <?php if ( isset ( $checkboxMeta['action'] ) ) checked( $checkboxMeta['action'][0], 'yes' ); ?> />make_action_happen<br />
As you can see at this point i want the checkbox to unhook something in woocommerce for this order only, so it only happens in this page for this session.
Anybody please help my coding is very very very basic.
1 comment