woocommerce_product_tabs
Filters the tabs on single product pages. Add your own tab, rename or reorder tabs, or remove Reviews.
When it fires
WooCommerce applies this filter in the single product tabs template (single-product/tabs/tabs.php). At priority 10 it adds the Description, Additional information and Reviews tabs, and at 99 it sorts all tabs by their 'priority' value.
Each tab is an array with a 'title', a 'priority' and a 'callback' that prints its content. The built-in tabs use priorities 10, 20 and 30.
Parameters
$tabsarray |
Array of product tabs. |
|---|
What to return
The array of tabs, keyed by tab ID.
Example: Add a Delivery tab and remove Reviews
add_filter( 'woocommerce_product_tabs', function ( $tabs ) {
unset( $tabs['reviews'] );
$tabs['delivery'] = array(
'title' => __( 'Delivery', 'my-snippets' ),
'priority' => 25,
'callback' => function () {
echo '<p>' . esc_html__( 'We dispatch within two working days.', 'my-snippets' ) . '</p>';
},
);
return $tabs;
}, 20 );
Good to know
- Use a priority between 11 and 98, so the built-in tabs exist when you change them and the sorting still applies.
- Block themes: the Product Details block with accordion items only picks up extra tabs you add here. To remove or rename its built-in sections, edit the block in the Site Editor.
- Removing the Reviews tab hides it but doesn't switch reviews off; do that under WooCommerce > Settings > Products.