287

How to Change WooCommerce Default Catalog Order By Price, Date, or Title

Powered by WPCodeBox

This WooCommerce snippet allows you to easily change the default catalog order by price, date, or title. Simply uncomment the desired option (price, date, or title) and comment out the others to customize your product sorting.


<?php

add_filter('woocommerce_default_catalog_orderby', function () {
     
     //return 'date';  
     //return 'title'; 
     return 'price';
});

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.