I am new in wordpress development. I want to do add settings in a product page in a new tab.
How to I add settings
code That I tried to add Tab
//add product tab link in admin
add_action( 'woocommerce_product_write_panel_tabs', array($this,'woocommerce_product_write_panel_tabs' ));
//add product tab content in admin
add_action('woocommerce_product_write_panels', array($this,'woocommerce_product_write_panels'));
/**
* woocommerce_product_write_panel_tabs
* Used to add a product custom tab to product edit screen
* @return void
*/
function woocommerce_product_write_panel_tabs(){
?>
<li class="custom_tab">
<a href="#custom_tab_data_ctabs">
<?php _e('Customstock Tabs', 'GWP'); ?>
</a>
</li>
<?php
}
/**
* woocommerce_product_write_panels
* Used to display a product custom tab content (fields) to product edit screen
* @return void
*/
function woocommerce_product_write_panels() {
global $post,$woocommerce;
$fields = array(
array(
'key' => 'custom_tabs_ids',
'label' => __( 'Select Custom Tabs', 'GWP' ),
'desc' => __( 'Start typing the Custom Tab name, Used for including custom tabs.', 'GWP' )
),
array(
'key' => 'exclude_custom_tabs_ids',
'label' => __( 'Select Global Tabs to exclude', 'GWP' ),
'desc' => __( 'Start typing the Custom Tab name. used for excluding global tabs.', 'GWP' )
),
array(
'key' => 'id',
'label' => __( 'Select Global Tabs to eclude', 'GWP' ),
'desc' => __( 'Start typing the Custom Tab name. used for excluding global tabs.', 'GWP' )
)
);
}