Ordering by ID, date, and title are all working for me. I think you might have problems because of your quotes. Make sure you use simple quotes.
[products limit='6' columns='2' orderby='id' order='desc']
-
This reply was modified 8 years, 3 months ago by
Caleb Burks.
Thanks! That turned out to not be the problem, but it did make me dig deeper, because it seemed the shortcode wasn’t the problem. Turns out the site developer had added a function to change the default sort order, and that was overriding the shortcode.
On the other hand, you were correct, single quotes are what I should have used.
Hi,
I’m dealing with the same issue, perhaps you could help me?
I have a snippet to change the default sort order for woocommerce products, which I would like to keep. However, for the [products] shortcode, there are times when I would like to change the order from DESC to ASC.
This is the snippet I use:
add_filter('woocommerce_get_catalog_ordering_args', 'am_woocommerce_catalog_orderby');
function am_woocommerce_catalog_orderby( $args ) {
$args['order'] = 'DESC';
}
$args['orderby'] = 'meta_value_num';
return $args;
}
For a certain shortcode, I would like to be able to change the order to ASC. It could probably be done with a if argument, but I’m not sure how to do it.
Example shortcode:
[products columns="6" limit="6" category="forthcoming" orderby="date" order="ASC" class="nyabocker-startsidan"]
Any help would be appreciated!
Johannes