Product table column widths
WooCommerce Product Table automatically sizes the columns for the best fit. You can override this behavior and control the column widths manually by adding the
widths option directly to the shortcode.
This is a way to force more or less space for specific columns in the table. For example, you can use this to increase the width of the Buy column if you have lots of variations or product options.
How to force column widths to a certain size
To use the widths option, you need to enter a value for each column in your table – either a percentage, a pixel amount or the word
auto to have the plugin calculate the width automatically.
For example, let's say you have 3 columns in your table -
price - and you want to set the width of name to 20%, description to 50% and price to 30%.
You can achieve this with the following shortcode:
[product_table columns="name,description,price" widths="20%,50%,30%"]
In the next example, we want to set the width of the first column to 50px and automatically size the other columns. We would use:
[product_table columns="name,description,date,buy" widths="50px,auto,auto,auto"]
auto is the default column width when no value is given, the above example can be simplified to the following:
[product_table columns="name,description,date,buy" widths="50px"]
The widths option isn't working
If the widths option isn't working, then it might be that you have set the width too narrow and the contents will no longer fit in the column. Instead of allowing it to look broken, the plugin will make the width wider so that the contents fit. Try increasing the width of the affected columns.
I have multiple tables on the same page and I want them all to line up
The column widths are calculated for each table individually. If you have more than one table on a page, you can use the
widths option to force the widths to be the same for each table by giving each table the same
My column widths change when I move from one page to the next, or use the filters
This can happen if the contents of a column contains a different number of characters for each product. The width of each column of the table is calculated based on the current products on that page of the table, so this might change when you perform a filter or go from one page to the next. Use the
widths option to force the columns to always be the same width.