Home / Archive / Woocommerce category archive sort products by date by default
Duplicate Snippet

Embed Snippet on Your Site

Woocommerce category archive sort products by date by default

Change the name of the category (in this e.g. gramatas). Now it will show newest products of this category first.

Code Preview
php
<?php
add_filter('woocommerce_default_catalog_orderby', 'quadlayers_catalog_orderby_for_category');
function quadlayers_catalog_orderby_for_category( $sort_by ) {
if( !is_product_category('gramatas') ) { 
return $sort_by; // modify gramatas category archive sorting
}
return 'date';
}

Comments

Add a Comment