Hi there,
I am using Sage with WooCommerce and sage-woocommerce library for my theme.
I was able to create custom templates for product custom taxonomy archive referring to this topic
But now I am struggling to find a way to have different template based on taxonomies for the content-product.blade.php
Example:
content-product.blade.php is different from content-product-{custom-taxonomy}-{term}.blade.php
The function wc_get_template_part(‘content’, ‘product-custom-taxonomy-term’) it doesn’t seem to work.
All I want to do is to have 2 different layouts based on the custom taxonomy term without using body class or multiple conditionals checking the queries inside the templates.
I am sorry, I didn’t find any solutions in your link.
As I said the problem is not for the archive loop template (the archive.blade.php according with sage-woocommerce) but for content-product.blade.php that is the file that shows the “single” product inside the archive loop.
For the archive.blade.php I already found a solutions that I posted earlier.
So you want to have a different content-product template, depending on what taxonomies that product belongs to.
You can override the wc_get_template_part filter (same name as the method using it) and conditionally use a different template file than the default one:
You would have to adjust the logic in the linked sample code, in this case by checking for the specific taxonomy or taxonomies and picking a matching template file (or for a combination of assigned taxonomies, etc.).