In a previous post, i show you How to remove product panel tabs from admin panel in woocommerce. Here i want to go on How to add custom product panel tabs in Woocommerce admin panel. So let’s have a look.
So First, You will Go to admin panel of your site and click on products menu link. From here click on any product to edit it or create a new product by clicking on Add New button.
You will show Product panel tab: General, Inventory,shpping etc. So here i show you add custom product panel tabs in Woocommerce admin panel. Here i will add “My Custom Field” tab in product panel tab.
So here is my code. Add below line of code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file. This will add “My Custom Field” Tab in product panel.
add_filter( 'woocommerce_product_data_tabs', 'wdo_add_my_custom_field' ); function wdo_add_my_custom_field( $tabs ) { $tabs['my-custom-field'] = array( 'label' => __( 'My Custom Field', 'woocommerce' ), 'target' => 'my_custom_field', 'class' => array( 'show_if_simple' ), ); return $tabs; }
If you want to add custom field under “My Custom Field” tab in product panel tab than Add below line of code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file.
add_action('woocommerce_product_data_panels', 'wdo_custom_product_data_fields'); function wdo_custom_product_data_fields() { global $post; // Note the 'id' attribute needs to match the 'target' parameter set above ?>If you want to change the position of "My Custom Field" product tab in admin panel than you will go with that How to change position of custom product panel tabs in Woocommerce admin panel.