Reputation: 51
In the backend under "Woocommerce" > "Status" window, WooCommerce provides three tabs:
Is there a filter available to add a new tab to this window?
Upvotes: 0
Views: 473
Reputation: 253773
Yes this is completely possible, with the 2 hooked functions below.
// Add a custom tab to WooCommerce Status section
add_filter('woocommerce_admin_status_tabs','add_custom_admin_status_tabs', 10, 1);
function add_custom_admin_status_tabs( $tabs ){
$tabs['custom_slug'] = __( 'Custom Title', 'woocommerce' );
return $tabs;
}
// Add the content of the custom tab to WooCommerce Status section
// ( HERE the hook is made of 'woocommerce_admin_status_content_' + the slug of this tab )
add_action( 'woocommerce_admin_status_content_custom_slug', 'add_custom_admin_status_content_custom_slug' );
function add_custom_admin_status_content_custom_slug(){
$key_slug = 'custom_slug';
?>
<table class="wc_status_table wc_status_table--<?php echo $key_slug; ?> widefat" cellspacing="0">
<tbody class="<?php echo $key_slug; ?>">
<tr class="section-name-1" >
<th valign="top" width="20%">
<p><strong class="name"><?php _e( 'Section name 1', 'woocommerce' ); ?></strong></p>
</th>
<td valign="top" class="content-section-1">
<p><?php _e( 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.', 'woocommerce' ); ?></p>
</td>
</tr>
</tbody>
</table>
<?php
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Tested and works. You will get:
Upvotes: 1