How to add custom tab to woocommerce product page

Woo-commerce Tab

Add a Custom Tab to Product Page

The ‘woocommerce_product_tabs’ filter provided by WooCommerce should be used as below to add a custom tab to a product page in WooCommerce. The code should be added to the functions.php file of your theme.

add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
    $tabs['desc_tab'] = array(
        'title'     => __( 'Delivery and Returns', 'woocommerce' ),
        'priority'  => 50,
        'callback'  => 'woo_new_product_tab_content'
   return $tabs;

Add Content To Tab

To add custom content to the tab you have to add another line of code in the function.php file.

function woo_new_product_tab_content() {
  // The new tab content
  echo '<p>Goods will be delivered....</p>';

Reorder the Tabs

Custom tabs that have been added can also be rearranged as per the requirement. To achieve this the  ‘woocommerce_product_tabs’ filter has to be used once more. The code for the same will be as below.

add_filter( 'woocommerce_product_tabs', 'sb_woo_move_description_tab', 98);
function sb_woo_move_description_tab($tabs) {
    $tabs['desc_tab']['priority'] = 5;
    $tabs['reviews']['priority'] = 20;
    return $tabs;

Leave A Comment

Your email address will not be published. Required fields are marked *