how to remove original forms in above and show only the tabs under general?
thanks,
this code solved the issue.
add_action('woocommerce_product_options_general_product_data', function() {
acf_form();
});
Hi @igeeksupport ,
It is becuase our fields are not text but has options.
Here is right code which worked for me.
You can change EAN and Brand according to your fields names.
/**
* Add the custom tab
*/
function my_simple_custom_product_tab( $tabs ) {
// Adds the new tab
if(get_field('ean')) //if there is custom field for this product, then show this tab
$tabs['my_custom_tab'] = array(
'title' => __( 'Bran and EAN', 'textdomain' ), //You can change Brand and EAN as you wish
'callback' => 'my_simple_custom_tab_content',
'priority' => 50,
);
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'my_simple_custom_product_tab' );
/**
* Function that displays output for the tab.
*/
function my_simple_custom_tab_content($slug, $tab ) {
?><h2><?php echo wp_kses_post( $tab['title'] ); ?></h2>
<?php
$brand= get_field_object('brand');
$ean= get_field_object('ean');
echo '<p>' . $brand['label']. ' : '. $brand['value'] .'</p>';
echo '<p>' . $ean['label']. ' : '. $ean['value'] .'</p>';
}
I tried this snipped.
I see only array wording in related tab.
How i can fix it.