That is actually supported and looks fine, however, it’s an IN query, so it will give products in either categories. You need an AND query, so add this:
operator="AND"
Thread Starter
tlsh39
(@tlsh39)
Thanks for your response Mike and I’m really sorry but I don’t understand where to add it.
I’m afraid I only know what I’ve read in the Woocommerce shortcodes documentation.
[product_category category="hampshire,anniversary" per_page="9" columns="3" orderby="date" order="desc" operator="AND"]
Thread Starter
tlsh39
(@tlsh39)
Great, thanks for your help!
This does not work.
Question still stands.
Needing to show products that are in multiple categories.
Succinct explanation with working shortcode needed.
The documentation is here:
https://docs.woocommerce.com/document/woocommerce-shortcodes/
Mike’s answer looks good and after all he is the plugin author! Ensure you are using a comma separated list of category slugs. In which way does it not work?
I didn’t ask for slugs, I asked for categories. Tested using slugs also and It doesn’t work here either.
-
This reply was modified 9 years, 4 months ago by
bbhank.
-
This reply was modified 9 years, 4 months ago by
bbhank.
If you want to use category names you will need to write your own shortcode. You can start with the WooCommerce product_category shortcode as a framework. This can be found at plugins/woocommerce/includes/class-wc-shortcodes.php line 167 on.
Link is not valid.
Checked the wooCommerce shortcode section before opening this thread. No info on selecting using multiple product categories.
-
This reply was modified 9 years, 4 months ago by
bbhank.
-
This reply was modified 9 years, 4 months ago by
bbhank.
Its not a link, its the location of a WooCommerce file in your server’s filesystem.
Mike’s answer shows us how to use a comma separated list of category slugs for the category parameter.
I’m asking how to use the categories themselves, not their slugs.
-
This reply was modified 9 years, 4 months ago by
bbhank.
You’ll need to write your own shortcode to do that. The WooCommerce shortcode can be used as a starting point. PHP skills or a developer will be needed.
Using the slugs doesn’t work here either.
In what way doesn’t it work? Please post the exact shortcode you are using. Use the code button. And also please post the url to the page where you have used it.