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) { unset($data['enabled']['pr']); unset($data['enabled']['ca']); unset($data['enabled']['sk']); $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 );
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?
Only when you modify the code / add a filter.
Is adding a column with a download link only possible by editing the plugin directly?
I wasn’t able to find any hooks in the code.
Well currently not, but we can customize / add this feature for you on Charge. Contact us at su*****@we******.io
Could it be, for example, that in a line of the table, which is a variation, an image appears, and in other variations, no?
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?
Why do you ask?
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?
You will need to reorder the data keys of the array.
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?
Hello !
Does your plugin work with the “Yith Request a Quote” plugin?
Not tested but it should work. Otherwise you can get a refund.
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.
That is currently not possible because it Shows only the variation attributes.
Does this plugin work with Elementor?
Yes sure! Simply use one of our shortcodes if you have a custom proudct layout built with Elementor.
Hi
I want Product sizes to be sorted from small to large.
How can I do that?
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?
We updated the FAQ. The code was not correct sorry.
Hi.
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.
Is there a way to remove specific attributes from being shown in the table?
Well currently not, but we can customize / add this feature for you on Charge. Contact us at su*****@we******.io
There’s an option to change the “Add all To Cart” text? I couldn’t find anything in the opcions
You can change the text using Loco Translate plugin as this is a system string.