Hi,
I'm using WooCommerce and WooCommerce Catalog Visibility Options plugins.
I want to remove some tabs in product data box, such as General, Inventory, Shipping and Restrictions tabs. I have removed the first three tabs, except for the Restrictions, by adding the code below in functions.php:
From researching, I know that the Restrictions tab is added by WooCommerce Catalog Visibility Options plugin. I dig round into the source code and I found the way how the Restrictions was added:
I also tried this:
But it didn't work at all. I'm kind new to php, can anyone help me to remove the restrictions tab properly?
I'm using WooCommerce and WooCommerce Catalog Visibility Options plugins.
I want to remove some tabs in product data box, such as General, Inventory, Shipping and Restrictions tabs. I have removed the first three tabs, except for the Restrictions, by adding the code below in functions.php:
PHP:
add_filter( 'woocommerce_product_data_tabs', 'woo_remove_product_tabs', 10, 1 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['general'] );
unset( $tabs['inventory'] );
unset( $tabs['shipping'] );
unset( $tabs['restrictions'] );
return $tabs;
}
PHP:
public function __construct() {
add_action( 'woocommerce_product_write_panel_tabs', array( $this, 'add_tab' ) );
}
public function add_tab() {
?>
<li class="wc_catalog_restrictions_tab wc_catalog_restrictions">
<a href="#wc_catalog_restrictions"><span><?php _e( 'Restrictions', 'wc_catalog_restrictions' ); ?></span></a>
</li><?php
}
I also tried this:
PHP:
add_filter( 'woocommerce_product_write_panel_tabs', 'remove_restrictions_tab' );
function remove_restrictions_tab( $tabs ) {
unset( $tabs['restrictions'] );
return $tabs;
}
But it didn't work at all. I'm kind new to php, can anyone help me to remove the restrictions tab properly?
Last edited: