If the preceding recipe doesn't give you enough options to sort your products, you can add custom code to meet your needs. With a bit of code, you can sort products from the oldest to the most recent.
We'll need to add two pieces of custom code. The first piece of code will add an option to the sorting drop-down.
Add the following code at the bottom of your theme's
functions.php
file underwp-content/themes/your-theme-name/
or in your custom WooCommerce plugin:// Add a new sorting option add_filter( 'woocommerce_default_catalog_orderby_options', 'woocommerce_cookbook_catalog_orderby' ); add_filter( 'woocommerce_catalog_orderby', 'woocommerce_cookbook_catalog_orderby' ); function woocommerce_cookbook_catalog_orderby( $sortby ) { $sortby['oldest_to_newest'] = __( 'Sort by oldest to newest', 'woocommerce' ); return $sortby; }
This code should add a new option to the sorting drop-down.
Unfortunately, WooCommerce doesn't...