WooCommerce guide

How to add the same tab to many WooCommerce products

Shipping, returns, warranty, sizing: some tabs belong on dozens or hundreds of products. Copying the same text into each product is slow, and it goes out of date the first time the policy changes. Here are three better ways, from a snippet to bulk tools.

Option 1: a snippet with a condition

If the text rarely changes, a snippet can add a tab to every product, or to every product in certain categories:

add_filter( 'woocommerce_product_tabs', 'mystore_add_brewing_tab', 98 );
function mystore_add_brewing_tab( $tabs ) {
    global $product;
    if ( ! $product instanceof WC_Product ) {
        return $tabs;
    }
    // Only products assigned to these category slugs.
    if ( ! has_term( array( 'coffee', 'tea' ), 'product_cat', $product->get_id() ) ) {
        return $tabs;
    }
    $tabs['brewing'] = array(
        'title'    => __( 'Brewing guide', 'mystore' ),
        'priority' => 25,
        'callback' => 'mystore_brewing_tab_content',
    );
    return $tabs;
}

function mystore_brewing_tab_content( $key, $tab ) {
    printf( '<h2>%s</h2>', esc_html( $tab['title'] ) );
    echo wp_kses_post( wpautop(
        "Use 60 g of coffee per litre of water.\n\nWater just off the boil, 92–96 °C."
    ) );
}

Replace 'coffee', 'tea' with your category slugs (Products → Categories shows them), or delete the has_term() check to show the tab on every product. Add it with a child theme or a snippets plugin, as in how to add a custom product tab.

This works, with limits you should know before you rely on it:

Option 2: saved tabs (Tabwright, free)

In Tabwright, a saved tab is written once and added to any number of products. Products point to the saved tab rather than copying it, so one edit updates all of them.

  1. Go to WooCommerce → Product Tabs → Saved tabs and add a tab, for example “Shipping & returns”, with the WordPress editor. An optional admin label helps tell similar tabs apart, like EU and US shipping.
  2. Edit a product, open Product data → Product tabs, pick the saved tab from the list and click Add saved tab.
  3. Reorder it among the product’s own tabs if needed, and update the product.

Saved tabs are free and unlimited. The catch: in the free plugin you attach a saved tab product by product. That’s quick for 20 products and tedious for 2,000.

Moving from YIKES Custom Product Tabs? Its saved tabs import as Tabwright saved tabs and stay linked to their products. See the migration guide.

Option 3: bulk assign and rules (Tabwright Pro)

Tabwright Pro is a paid add-on that puts a saved tab on many products without opening each one. There are two ways.

Bulk assign

In Products → All Products, select products and choose the saved tab under Add product tab (or Remove product tab) in the Bulk actions menu. To select by criteria instead, use WooCommerce → Product Tabs Pro → Bulk assign and match by category, tag, product type, stock status or product. Bulk assign writes the tab into each product’s tab list, exactly as if you had added it by hand, so you can still reorder or remove it on any product later.

Conditional tabs

Instead of assigning, give the saved tab display rules and it appears automatically on every matching product, including products you add later. Rules can use products, categories (a parent category also matches products in its child categories), tags, product types, stock status, customer role or logged-in versus guest. Combine include and exclude conditions and choose whether all or any must match. Rule-based tabs appear after the product’s own tabs and never show twice on a product that also has the tab assigned by hand.

Which one? Use bulk assign when the list of products is fixed, and rules when the catalog changes. Saved tabs in Pro can also have a visible-from and visible-until date, which suits seasonal notices like holiday shipping cut-offs.

Two honest caveats. Rules by customer role differ per visitor, so if your page cache serves the same HTML to everyone, stick to product-based rules. And bulk assign by criteria runs in one request, in batches of 200 products, which is fine for most stores but can be slow on very large catalogs.

Pro also adds a tabs column to WooCommerce’s product CSV importer and exporter if you manage your catalog in spreadsheets. Pro costs $49 a year for one site; see pricing.

FAQ

If I edit a saved tab, does it change on every product?

Yes. Products store a reference to the saved tab, not a copy, so one edit updates every product that uses it.

Can I keep one product from getting a tab that a rule adds?

Yes, with an exclude rule for that product in the saved tab’s display rules. There is no per-product switch in the product editor yet.

What happens if I stop using Pro?

Tabs you bulk assigned stay, because they are stored in each product’s tab list like tabs added by hand. Tabs shown only by rules stop appearing, because rules are a Pro feature.

Get it free on WordPress.org: coming soonAbout Tabwright