I'm currently developing the homepage for a Woocommerce website and on this page the goal is to have 3 rows displaying products from different brands. Example; Row 1 will display Apple Products, Row 2 will display Samsung Products and Row three will display HTC products.
I've used the plugin CPT UI to create the custom taxonomy 'Brand'. Now I wish to use the example above to display only products listed under a particular brand.
Looking into the Woocommerce Shortcodes, I saw this:
[products limit="8" columns="4" category="hoodies, tshirts" cat_operator="AND"]
Is there away to do something like this with a custom taxonomy for this case brands? I.E:
[products limit="8" columns="4" brand="apple" cat_operator="AND"]
Any assistance or nudges in the right direction are much appreciated!
It's possible to extend Woocommerce
[products]
shortcode to To handle any custom taxonomy like"brand"
with some kind of trick.The code:
Code goes in function.php file of your active child theme (or active theme). Tested and works.
USAGE
We will use the
class
shortcode argument here:1) One Brand - Displaying products from "Apple" brand:
2) multiple Brands - Displaying products from "Apple" and "Samsung" brands: