Product Tab Generator
Add tabs to the single product page, remove the core ones you don't want, and both live in one filter callback so priority ordering never fights itself.
<?php // Generated with WP CodeKit — powered by GrowQuest (https://growquest.io). /** * Plugin Name: Product tabs * Description: Adds 1 tab and removes 1 core tab. * Version: 1.0.0 * Requires PHP: 7.4 * Requires Plugins: woocommerce * Text Domain: acme */ defined( 'ABSPATH' ) || exit; /** * Add and remove tabs on the single product page. * * @param array $tabs Existing tabs, keyed by id. * @return array */ function acme_product_tabs( $tabs ) { unset( $tabs['reviews'] ); $tabs['sizing'] = array( 'title' => __( 'Sizing', 'acme' ), 'priority' => 15, 'callback' => 'acme_tab_sizing', ); return $tabs; } add_filter( 'woocommerce_product_tabs', 'acme_product_tabs' ); /** * Render the "Sizing" tab. */ function acme_tab_sizing() { echo wp_kses_post( wpautop( __( 'Runs true to size. If you are between sizes, we recommend sizing up.', 'acme' ) ) ); }
About this generator
Product Tab Generator Online
Add or remove tabs on the single product page through the woocommerce_product_tabs filter. Register a WooCommerce custom product tab with its own title, priority and render callback, unset the core Description, Additional information or Reviews tabs, and get one clean filter function that does both instead of three snippets fighting each other.
The Reference tab lists the core tabs with the priorities WooCommerce assigns them — Description 10, Additional information 20, Reviews 30 — so you can see exactly where your own tab will land before you paste anything. Free to use, no account, nothing uploaded.
Reviewed Output tested on WordPress 6.8 · PHP 8.3
Why the Product Tab Generator beats a hand-written woocommerce_product_tabs filter
The filter itself is simple; the ways it goes wrong are not. Reuse a core tab key and you replace the Description tab instead of adding a tab. Forget the callback and the tab renders as an empty pill. Add and remove in two separate filter callbacks and the ordering depends on which one WordPress happens to run first. This generator writes one filter that unsets and adds together, with the callbacks alongside it, and checks the keys before you ship.
Core tab keys are rejected
A new tab whose key resolves to description, additional_information or reviews is a hard error, with a message saying plainly that it would overwrite the core tab rather than add one.
Add and remove in a single filter
The unset() calls for the core tabs you switched off and the assignments for your new tabs live in the same callback, in that order, so there is no dependency on which filter runs first.
Priority drives the order, and it is yours to set
Each tab gets an explicit numeric priority. Core uses 10, 20 and 30, so a tab at 15 lands between Description and Additional information. A non-numeric priority is a warning and falls back to 50.
A real callback per tab
Every new tab gets its own named render function containing your content, escaped through wp_kses_post( wpautop( … ) ) and wrapped in __() with your text domain — not a // TODO comment.
Duplicate and blank keys caught
Two new tabs sharing a key is an error because the second overwrites the first, a tab with no title is an error because it renders as a blank pill, and a tab with no content is flagged as a tip since its callback would still print an empty paragraph.
An honest note about removing Reviews
Unsetting the reviews tab only hides it from the tab strip. The Checks tab says so, and points you at WooCommerce → Settings → Products, where reviews are actually enabled or disabled.
How does the Product Tab Generator work?
Four steps. Decide which core tabs stay, add your own, set the ordering, then export.
- 01
Choose which core tabs to keep
Toggle Description, Additional information and Reviews. Anything switched off becomes an
unset()call inside the generated filter. - 02
Add your own tabs
For each new tab set a key, the title shown on the pill, and the content it renders. The key becomes the array key and part of the callback function name.
- 03
Set the priority
Give each tab a numeric priority to place it against the core values of 10, 20 and 30. Lower numbers appear first in the strip.
- 04
Clear the checks, then export
Resolve any core-key collisions, duplicate keys or missing titles, then copy the snippet or download it as a
functions.phpblock or a plugin file.
Worked example — a Sizing tab, with Reviews removed
One new tab at priority 15, so it sits between Description and Additional information, and the reviews tab unset. This is the whole output, doc blocks trimmed.
function acme_product_tabs( $tabs ) {
unset( $tabs['reviews'] );
$tabs['sizing'] = array(
'title' => __( 'Sizing', 'acme' ),
'priority' => 15,
'callback' => 'acme_tab_sizing',
);
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'acme_product_tabs' );
function acme_tab_sizing() {
echo wp_kses_post( wpautop( __( 'Runs true to size. If you are between sizes, we recommend sizing up.', 'acme' ) ) );
}WooCommerce hides the Description tab automatically on a product with no description, and the Additional information tab on a product with no attributes or dimensions. A custom tab has no such rule — it appears on every product until you add your own condition inside the filter.
WooCommerce product tabs — frequently asked questions
The questions that come up when changing the tabs on the single product page.
How do I change the order of WooCommerce product tabs?
Each tab in the woocommerce_product_tabs array has a priority key and WooCommerce sorts by it before rendering. Core assigns Description 10, Additional information 20 and Reviews 30, so setting your tab to 15 places it second. You can also reorder core tabs by reassigning their priority inside the same filter.
How do I remove the Additional information tab?
Call unset( $tabs['additional_information'] ) inside a woocommerce_product_tabs filter and return the array. Note that WooCommerce already hides that tab on products with no attributes, no weight and no dimensions, so if it is showing there is data behind it that customers will no longer see.
Why is my custom product tab empty?
Either the callback key is missing from the tab array, or it names a function that does not exist at render time. WooCommerce calls that function to print the panel contents; without a valid callback the pill appears but the panel is blank. The generated code always writes a matching named function for every tab it adds.
Can I show a product tab only for certain products?
Yes — the filter runs on every single product page, so you can inspect the product before adding the tab. Use global $product; inside the filter callback and test whatever matters: a category with has_term(), a product type with $product->get_type(), or a custom field with $product->get_meta(). Only add the array entry when the condition passes.
Does removing the reviews tab disable reviews?
No. Unsetting the tab removes it from the tab strip only; reviews remain enabled, review data stays attached to the product, and the star rating still shows elsewhere in the template. To actually switch reviews off, use the Enable product reviews setting under WooCommerce → Settings → Products, or turn off comments per product.
Do product tabs work with block themes and the Product Details block?
The woocommerce_product_tabs filter drives the classic single-product template, which block themes still use through the Product Classic Template block or a shortcode-based product page. A fully block-based product page built from individual blocks does not render that tab strip at all, so a filter alone will not add a tab there — you would need the equivalent block or a template that includes the classic tabs output.
Where do I paste the code from the Product Tab generator?
You have three good options and one bad one. Best is a small site-specific plugin — the generator can output one for you, and it keeps working when you change theme. A code-snippets plugin is fine too. A child theme's functions.php works but ties the code to that theme. Never edit the parent theme: the next update overwrites it and your code is gone.
Can I use the generated code in client work or a commercial plugin?
Yes. The output is ordinary WordPress API calls that you configured — there is no licence attached to it and no attribution required. Use it in client sites, commercial plugins and themes, or products you sell. The generated file carries a short credit comment you are free to delete.
The other WooCommerce generators in the library, plus the WordPress tools most often used alongside this one.