Sorting & ordering the product table
WooCommerce Product Table comes with 2 options for sorting the table when it first loads. Once the table has loaded, customers can click on a column heading to sort by that column.
sort_by option controls which column the table is sorted by when it first loads. The default is
menu_order, which is the order set for each product under the Advanced tab in the Product Data section when editing a product.
You can sort by any of the following keywords:
rating (sort by average reviews) or
rand (random ordering).
If you’re not using the lazy load option then you can also sort by any other column present in the table. E.g.
sort_by="description". For lazy load tables, you can only sort by the keywords listed above. This is because the sorting is handled by the server when the products are retrieved from the database.
Sort using keyword:
[product_table columns="name,tags,categories,price,add-to-cart" sort_by="rating"]
Sort using column in table:
[product_table columns="sku,image,name,price,add-to-cart" sort_by="sku"]
sort_order option controls the direction in which the table is sorted. Use
asc for ascending order or
desc for descending order.
The defaults is
desc for date sorting and
asc for everything else.
[product_table columns="name,price,add-to-cart" sort_by="price" sort_order="desc"]
Can I sort by multiple columns?
No, this is not currently possible. The table can only be sorted by a single column.