Skip to content if (class_exists('acf') && class_exists('WooCommerce')) {
add_filter('woocommerce_product_tabs', function($tabs) {
global $post, $product; // Access to the current product or post
$custom_tab_title = get_field('tab_title', $post->ID);
if (!empty($custom_tab_title)) {
$tabs['awp-' . sanitize_title($custom_tab_title)] = [
'title' => $custom_tab_title,
'callback' => 'awp_custom_woocommerce_tabs',
'priority' => 10
];
}
return $tabs;
});
function awp_custom_woocommerce_tabs($key, $tab) {
global $post;
?>ID);
echo $custom_tab_contents;
}
add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 98 );
function woo_customize_tabs( $tabs ) {
$tabs['additional_information']['title'] = __( 'Technical specifications' );
$id = get_the_ID();
$ftab = get_post_meta($id,'faq',true);
if(!empty($ftab)) {
$tabs['test_tab'] = array(
'title' => 'FAQ',
'priority' => 20,
'callback' => 'extra_faq_field'
);
}
return $tabs;
}
add_action( 'woocommerce_product_additional_information', 'print_custom_html',15 );
function print_custom_html(){
$id = get_the_ID();
$ttab = get_post_meta($id,'technical_specifications',true);
if(!empty($ttab)) {
echo 'Technical specifications
';
echo '';
?>