Add your own tab to every product page, such as Shipping & Returns, with content you write once.
add_filter( 'woocommerce_product_tabs', function ( array $tabs ): array {
$tabs['nahnu_shipping'] = [
'title' => 'Shipping & returns',
'priority' => 25,
'callback' => 'nahnu_shipping_tab_content',
];
return $tabs;
} );
function nahnu_shipping_tab_content(): void {
?>
<h2>Shipping & returns</h2>
<p>Orders ship within 2 business days. Free returns within 30 days of delivery.</p>
<p><a href="<?php echo esc_url( home_url( '/shipping/' ) ); ?>">Read the full policy</a></p>
<?php
}
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Shipping and returns, sizing and care instructions are the same for most products. Rather than repeating them in every description, put them in a tab that appears on every product page.
The woocommerce_product_tabs filter accepts new tabs. Each needs a unique key, a title, a priority (WooCommerce uses 10, 20 and 30 for its own tabs, so 25 places this one between Additional information and Reviews) and a callback function that prints the content.
The callback runs only when the tab is shown, so the content is always current.
get_post_field( 'post_content', $page_id ) instead.has_term() or global $product inside the filter before adding it.Open a product page. A “Shipping & returns” tab should appear between the default tabs.