View my basket

Variable Product Tables for WooCommerce

Render product variations as rows in a table, or show product attributes as radio buttons to merge variations into a fewer rows. Product variation tables are a great way to help your customers make quick, accurate selections.

Variable Product Tables for WooCommerce

$35

Licences for this plugin last forever 😀

14 Days Money-back guarantee

100% No-Risk, Money Back Guarantee!

Over the next 14 days, if our plugins aren't right for you, we’ll refund 100% of your money. No questions asked!

SKU: PP-VPT-L01-R00 Category: Current: 1.2.1

About the Product Tables Plugin

Variable Product Tables for WooCommerce takes all of your available variations and places them into table rows.

You can represent each product attribute as a table column, or use radio buttons to combine several variations into a single row. Using radio buttons like this reduces the size of the table when you’ve got a lot of variations. This makes it super easy for your customers to make quick, accurate selections.

The tables themselves can be displayed in the Add-to-Cart area, or they can be injected into the product page between the product gallery and the product tabs (to take advantage of the available page width).

The whole plugin is developer-friendly, with actions and filters that let you fine-tune the plugin’s behaviour and appearance.

Sample configurations

Add-to-cart area

Replace the standard add-to-cart drop-downs with a variations table. This one shows the “pa_fit” product attribute (Mens/Womens) as a regular column. The “pa_size” and “pa_colour” attributes are shown as radio/pill buttons in a single column. We’ve also removed the “”quantity” column and placed the price into the final column, to create lots of space for the radio buttons.

Below-the-fold

Inject a full product-variations table before the product tabs. Add/remove Quantity and SKU columns, and pivot one or more product-attribute columns into radio buttons (which reduces the overall number of rows in the table).

Dynamically Reconfiguring the Tables

Use the vpt_table_options filter to reconfigure how the product tables are rendered on the WooCommerce Single Product page.

// Override the variations table on a product page.
$options = apply_filters('vpt_table_options', array $options, int $product_id);

The $options parameter is an associative array that looks like this:

$options = array(
	// Is the table enabled or not
	'enabled' => true,

	// An array of product IDs to include in the table. Usually this is a single
	// value - the product ID of the variable product. Child variations are
	// added automatically.
	'product_ids' => array(),

	// If the table contains any radio buttons, should we try to auto-select
	// valid product variations on page load.
	'auto_select_on_load' => true,

	// Automatically convert all product attributes to radio buttons.
	'all_attributes_as_pills' => false,

	// Automatically convert (only) the first product attribute to radio buttons.
	// This has a higher priority than all_attributes_as_pills.
	'first_attribute_as_pills' => false,

	// If there are radio-button product attributes, merge them into a single
	// on-screen column.
	'single_pills_column' => false,

	// Move the price field into the add-to-cart column
	'is_price_in_addtocart_column' => $settings->get_bool(OPT_IS_PRICE_IN_ADDTOCART_COLUMN),

	// You explicitly pass product parameters that you want to see as radio
	// buttons, like "pa_colour", "pa_size", etc.
	'pill_attributes' => array(),

	// Hide or show the inc/dev +/- buttons by the Quantity input fields.
	'show_inc_dec_buttons' => $settings->get_bool(OPT_SHOW_QTY_INC_DEC),

	// A list of columns you want to "switch off", such as "sku" or "image".
	'disable_columns' => array(),
);

Example usage

You can set the defaults so the product tables render with each row representing a single variation. The following snippet will always render the size (pa_size) attribute as radio buttons. The snippet will not cause an error if the product does not have the size attribute.

/**
 * Variable Product Table options
 */
function custom_vpt_table_options($options, $product_id) {
	// Add the "pa_size" attribute to the array of attributes that get
	// converted into radio/pill buttons.
	$options['pill_attributes'][] = 'pa_size';

	return $options;
}
add_filter('vpt_table_options', 'custom_vpt_table_options', 10, 2);

Notice how radio buttons cause the table to be pivoted, so we only need two rows to show all the data instead of four.

More examples

Change the options based on a product’s category.

function custom_vpt_table_options($options, $product_id, $location) {
	// Products in the "clothing" category should have the "pa_size" attribute
	// rendered as radio buttons, and we don't need to see SKU in there.
	if (has_term('clothing', 'product_cat', $product_id)) {
		$options['pill_attributes'][] = 'pa_size';
		$options['disable_columns'][] = 'sku';
	}

	return $options;
}
add_filter('vpt_table_options', 'custom_vpt_table_options', 10, 3);

Disable product tables for every product in the “electronics” category.

function custom_vpt_table_options($options, $product_id) {
	// Disable product variation tables for all electroics products.
	if (has_term('electronics', 'product_cat', $product_id)) {
		$options['enabled'] = false;
	}

	return $options;
}
add_filter('vpt_table_options', 'custom_vpt_table_options', 10, 2);

If you want per-product control of how the tables look, you can use Advanced Custom Fields (ACF). In this example, we’ve created a true/false field called “all_attributes_as_buttons”. The following PHP snippet will pick up on this and reconfigure the table for all products where it’s set to true.

function custom_vpt_table_options($options, $product_id) {
	// If a product has the ACF Field (post_meta_ "all_attributes_as_buttons"
	// set to "true" then show all product attributes as radio buttons and hide
	// the Quantity column
	if (filter_var(get_post_meta($product_id, 'all_attributes_as_buttons', true), FILTER_VALIDATE_BOOLEAN)) {
		$options['all_attributes_as_pills'] = true;
		$options['first_attribute_as_pills'] = false;
		$options['disable_columns'][] = 'quantity';
	}

	return $options;
}
add_filter('vpt_table_options', 'custom_vpt_table_options', 10, 2);

Actions & Filters

HookParametersNotes
vpt_table_options
filter : options
$options
$product_id
Associative array of options used to render a product table on the WooCommerce single product page. See the
vpt_dec_qty_button_html
filter : string
$htmlInner HTML for the decrease-quantity button. Default is a Font Awesome icon.
vpt_inc_qty_button_html
filter : string
$htmlInner HTML for the increase-quantity button. Default is a Font Awesome icon.
vpt_default_add_to_cart_quantity
filter : int
$amountThe default number of units loaded into the Quantity input field. Default value is “1” (one).
Hooks you can use with the Variable Product Tables plugin

Changelog: Variable Product Tables

Version 1.2.1

Released: 2023-10-20

  • Added a new column type called "meta" to make it easier to add custom product variation meta data columns to the tables. At the moment, this needs to be hooked in a filter, but we will add a column-editor to the back-end to make this possible without coding.

Version 1.2.0

Released: 2023-10-14

  • Added a new option to convert all product attributes to radio buttons, apart from the first attribute.
  • Added an option to centre-align the text in the columns, without having to use custom CSS

Version 1.1.0

Released: 2023-10-08

  • Added de-DE language (machine translated, but looks OK)
  • Added option to move the price into the add-to-cart column
  • Added options to hide/show the Quantity and SKU columns
  • Added an option to style the tooltip that pops up when a product has been added to the cart

Older releases

  • Official release. Includes the settings area for styling the radio buttons - shared with our Product Variation Radio Buttons plugin
  • Removed some diagnostics messages in preparation for the first full release.
  • Initial pre-release

Reviews

There are no reviews yet.

Be the first to review “Variable Product Tables for WooCommerce”

Variable Product Tables for WooCommerce
Variable Product Tables for WooCommerce
$35