If you want to enable or disable specific product data for the variations table you can use the “woocommerce_variations_table_data” filter like below.

Modify Existing Data

In this example for the product ID 565 it has no price (pr), no add to cart (ca) and no sku (sk). Instead we added Stock (st) and Dimensions.

function modify_variations_table_data($data) {
	global $product;

	if($product->get_id() == 565) {
		$data['enabled']['stock'] = 'Stock';
		$data['enabled']['dimensions'] = 'Dimensions';
    return $data;
add_filter( 'woocommerce_variations_table_data', 'modify_variations_table_data', 10, 1 );

Reference of Variables:

  • ‘im’ => Image
  • ‘sk’ => SKU
  • ‘pr’ => Price
  • ‘st’ => Stock
  • ‘at’ => Attributes
  • ‘ca’ => Add to Cart
  • ‘de’ => Description
  • ‘di’ => Dimensions
  • ‘we’ => Weight

Add custom Post Meta Data

If you want to add custom post meta data you have to set the post meta key in the filter array key and the name in the value element. An example:

function add_post_meta_to_variation_table($data) {
	global $product;

	$data['enabled']['my_custom_post_meta_key'] = 'Meta Key Title';

    return $data;
add_filter( 'woocommerce_variations_table_data', 'add_post_meta_to_variation_table', 10, 1 );

22 thoughts on “Modify the Variations Table Data Fields

  1. Luis Villagran says:

    Hi, i’m trying to add a custom download link at the end of every variation in the table. ¿How can i accomplish this? I need a column in the variation table that has a download link for every item. Is this possible?

  2. Cristian says:

    Could it be, for example, that in a line of the table, which is a variation, an image appears, and in other variations, no?

  3. Ivan says:

    Hello, I have made the filter to add the image to articles that I want, but it is added at the end of the table, is it possible to put it in the first column?

      • ivan says:

        Hello because I need it to appear in the first column. The first thing I did was add the image column in the plugin options, and remove that column in the products that I do not want to appear, but there are more products that I do not want to appear and few that do, so I opted for the option. adding the column, but I ran into the problem that adds it at the end, after the add to cart button, and I want the first column to be added, is it possible?

  4. ivan says:

    Hello, because I have products that must come out with the image column and others that don’t, but there are many more that do not come out with the image column, so I add that column with that code but the last one puts it, and I need the first one to appear , it’s possible?

  5. Andrew Turner says:

    Is it possible to remove columns (various Attributes) from the Variation Data table? Currently in the table configuration there is a drag and drop data field element, but all Attributes are grouped in the one element. I do not need all attributes to be shown, only say 3 columns.

  6. Gary says:

    Hi I am working on adding a custom Variation Field to the Variation Table. I thought I would start by adding a simple function to my theme’s function.php file and add the existing ‘Stock’ field to the table using a simplified version of your code:

    function modify_variations_table_data($data) {
    global $product;
    $data = ‘Stock’;
    return $data;
    add_filter( ‘woocommerce_variations_table_data’, ‘modify_variations_table_data’, 10, 1 );

    This results in a warning and an error when viewing a product with a variations table:
    Illegal string offset ‘enabled’ in /wp-content/plugins/woocommerce-variations-table/public/class-woocommerce-variations-table-public.php on line 396
    Uncaught Error: Cannot unset string offsets in /wp-content/plugins/woocommerce-variations-table/public/class-woocommerce-variations-table-public.php:397
    Any ideas on why this simple version of your function is not working?

  7. Kambiz says:

    Is it possible to show “form shortcode” or “simple box” for out of stock variables in the variation table? for example instead of showing “out of stock” ?
    customers can give us email or phone number in the form or simple box, and whenever that variable is in stock again, we can notify them to buy.

Leave a Reply

Your email address will not be published. Required fields are marked *