I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot:
Now in another page let's say example/foo
On that page I use a WooCommerce shortcode:
[product_category per_page="90" columns="3" orderby="" order="ASC" category="foo" prdctfltr="yes" pagination="yes"]
But the sorting dropdown is not shown.
What I am doing wrong? How can I display the sorting dropdown?
I have a WordPress site, with WooCommerce. The WooCommerce archives pages as shop display a dropdown sorting filter like in this screenshot:
Now in another page let's say example/foo
On that page I use a WooCommerce shortcode:
[product_category per_page="90" columns="3" orderby="" order="ASC" category="foo" prdctfltr="yes" pagination="yes"]
But the sorting dropdown is not shown.
What I am doing wrong? How can I display the sorting dropdown?
Share Improve this question edited May 6, 2019 at 23:46 LoicTheAztec 3,39117 silver badges24 bronze badges asked May 6, 2019 at 20:56 TheGejrTheGejr 331 gold badge1 silver badge4 bronze badges2 Answers
Reset to default 4Since WooCommerce 3.2, Woocommerce shortcodes and their available attributes have changed.
So try the following shortcode instead (for "foo" product category):
[product_category limit="90" columns="3" category="foo" paginate="true"]
or inside php code:
echo do_shortcode( '[product_category limit="90" columns="3" category="foo" paginate="true"]' );
Now you will see that the sorting options dropdown appear.
Note: orderby
argument with an empty value has no effect. order
argument is ASC
by default.
If you would rather want to get the sorting menu using a shortcode then you can create one for it in your functions.php
// Creating Shortcode for Product Sorting
add_shortcode('wc_sorting','woocommerce_catalog_ordering');
Then simply call the shortcode in your catalog page:-
- In Legacy Editor/Gutenberg:
[wc_sorting]
- or in your PHP file:
echo do_shortcode('[wc_sorting]');