Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the available options for the orderby attribute in the shortcode


What are the available options for the orderby attribute in the shortcode


The `orderby` attribute in the WooCommerce product sorting shortcode allows you to specify how products should be ordered. Here are the available options:

- `menu_order` - Orders products based on the menu order set in the product's editing screen[1][2].
- `title` - Orders products alphabetically by title[1].
- `date` - Orders products by publish date, with the newest first[1][2].
- `rand` - Orders products randomly[1].
- `id` - Orders products by ID[1].
- `price` - Orders products by price, with the lowest price first[2].
- `price-desc` - Orders products by price, with the highest price first[2].
- `popularity` - Orders products by popularity, determined by sales[2].
- `rating` - Orders products by average product rating[2].

You can also use the `order` attribute to specify the sort direction, either `asc` for ascending order or `desc` for descending order[2].

Additionally, you can use the `taxonomy` and `term` attributes to filter products by specific categories or tags[2].

Citations:
[1] https://www.uncannyowl.com/knowledge-base/woocommerce-shortcodes/
[2] https://barn2.com/blog/woocommerce-product-sorting/
[3] https://www.nsp-code.com/automatically-order-woocommerce-products-based-on-attributes/
[4] https://stackoverflow.com/questions/69457962/how-to-order-woocommerce-products-by-attribute-term-menu-order
[5] https://www.wpfloor.com/change-woocommerce-attributes-sort-order/