Reply 196573 to: Product description

Avatar: Rose Tyler
Rose Tyler
Support staff
July 12, 2018 at 09:16

Hello,

Please note that add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); can be used in functions.php file only once.
Here is an example of code to add 2 tabs:
http://prntscr.com/k5ib0j

add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
    
    // Adds the new tab
    
    $tabs['test_tab'] = array(
        'title'     => __( 'New Product Tab', 'woocommerce' ),
        'priority'  => 50,
        'callback'  => 'woo_new_product_tab_content'
    );

    $tabs['test_tab2'] = array(
        'title'     => __( 'New Product Tab 2', 'woocommerce' ),
        'priority'  => 20,
        'callback'  => 'woo_new_product_tab_content2'
    );

    return $tabs;

}
function woo_new_product_tab_content() {

    // The new tab content

    echo '<h2>New Product Tab</h2>';
    echo '<p>Here\'s your new product tab.</p>';
    
}

function woo_new_product_tab_content2() {

    // The new tab content

    echo '<h2>New Product Tab2</h2>';
    echo '<p>Here\'s your new product tab contnent for 2nd tab.</p>';
    
}

Regards

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.