Advertisement

Woo Commerce Extra Product Tabs in Single Product: Without Using any plugin | (Step-by-Step).

Woo Commerce Extra Product Tabs in Single Product: Without Using any plugin | (Step-by-Step).

Php you Will need:

// Add multiple custom tabs using SCF fields
add_filter( ‘woocommerce_product_tabs’, ‘acf_multiple_custom_product_tabs’ );

function acf_multiple_custom_product_tabs( $tabs ) {
global $post;
// Loop through the 5 custom tabs
for ( $i = 1; $i <= 5; $i++ ) { // Get the title and content from the ACF fields $custom_tab_title = get_field( ‘custom_tab_’ . $i . ‘_title’, $post->ID );
$custom_tab_content = get_field( ‘custom_tab_’ . $i . ‘_content’, $post->ID );
// Add the tab only if there is a title and content
if ( $custom_tab_title && $custom_tab_content ) {
$tabs[‘acf_custom_tab_’ . $i] = array(
‘title’ => esc_html( $custom_tab_title ),
‘priority’ => 50 + $i, // Adjust priority so tabs appear in the correct order
‘callback’ => function() use ( $custom_tab_content ) {
echo wp_kses_post( wpautop( $custom_tab_content ) );
}
);
}
}
return $tabs;
}

Css you Will need:

.woocommerce div.product .woocommerce-tabs ul.tabs li a{
margin-bottom:10px;
font-size:14px;
padding:10px 20px 10px;
}

Related Posts

Get Even More

You will get your Latest Post Directly to your Email Box!

Stay Connected

Advartisement

Oak Grove Disc Golf Course in Pasadena is the world’s …

Explore the world of cybersecurity in this comprehensive study, where …