Hi,
This is a nice feature. Thanks for the suggestion.
However, it is not possible with current version but I would definitely try to add this in future release.
For now you can add this code in theme functions.php and let me know if this works.
/**
* Order products by stock status.
*
* @param array $args
* @return array $args
*/
function wpes_support_16872473($args) {
if (function_exists('WPES') && is_search() && empty($_GET['orderby'])) {
$args = [
'meta_key' => '_stock_status',
'orderby' => [
'meta_value' => 'ASC',
'date' => 'DESC'
],
'order' => 'DESC'
];
}
return $args;
}
add_filter('woocommerce_get_catalog_ordering_args', 'wpes_support_16872473');
Thanks
Thread Starter
hgieg
(@hgieg)
Worked perfectly.
Thanks for the code and for considering adding this feature in a future update.