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.

acme-product-tabs.php
Saved just now
Core tabs to keep
New tabs
1 added · 2 of 3 core tabs kept
Sizingsizing
<?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' ) ) );
}