Skip to content

Instantly share code, notes, and snippets.

View kerekesz's full-sized avatar
🏠
Working from home

Zoltán Kerekes kerekesz

🏠
Working from home
View GitHub Profile
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];