WooCommerce: sort products from oldest to most recent
Posted on This might be outdated!
Here is a quick snippet that will be handy for many of you! This snippet allows you to create a new default sorting method to list your products from oldest to most recent. To use it, simply add the following code in the file called functions.php in your theme folder:
Here is the result in the administration:
Hi. Thanks for your tutorials. I have added some custom meta fields for my products using a post you wrote about a year ago, but have not yet figured out how to be able to sort products using these custom fields by adding them to the sort options like you did above.
I can get new sorting options to appear in the dropdown, but they don’t actually draw any info from the custom fields it seems. Can you give me some direction on how I can make this work?