/**
 * Register new WooCommerce product tab.
 *
 * @param array $tabs WooCommerce product tabs.
 *
 * @return array
 */
function dorzki_register_product_tab( $tabs ) {

  $tabs['shipping'] = [
    'title'    => __( 'Shipping Information', 'dorzki' ),
    'priority' => 100,
    'callback' => 'dorzki_shipping_information_tab'
  ];

  return $tabs;
  
}

add_filter( 'woocommerce_product_tabs', 'dorzki_register_product_tab' );


/**
 * Print `Shipping Information` tab contents.
 */
function dorzki_shipping_information_tab() {

  echo '<h2>' . __( 'Shipping Information', 'dorzki' ) . '</h2>';
  echo '<p>' . __( 'We ship worldwide, shipping price depends on the destination country.', 'dorzki' ) . '</p>';
  
}

How to use it?

Usually adding functionality to a WordPress site is by creating a plugin.
However you can simply copy the code and paste it in your child theme’s functions.php file at the end of the file, just before ?>.

For JavaScript code you will need to add them to your theme’s main JavaScript file.

Having issues with the code?

If the code doesn’t work or you get an error please let us know in the comments section.
We will do our best to fix it as-soon-as-possible and update the code on this page.

Comments

  1. Mark

    How can I change an existing tab?

    Reply
    1. Dor Zuberi

      Hi Mark,
      You can change an existing tab by using the tad ID, for example if we would like to change the “Reviews” tab title you can do that like the following:

      $tabs['reviews']['title'] = esc_html__( 'What Customers Say', 'dorzki' );

Leave a Reply