Woocommerce custom taxonomy filtering
Hey guys here's the situation:
We have a woocommerce site hooked up with woocommerce product filters - the filter works perfectly on category pages, however, we have a custom taxonomy template for taxonomies we have added to the site.
For example if you were to have a WC site selling apples, you have multiple different categories of apples but you also have a custom taxonomy of apple colour.
For the apple color archive page, the filters that work on category page now longer have no effect:
Here is my template code:
$term = get_queried_object();
$image = wp_get_attachment_url( $thumbnail_id );
$params = array(
'posts_per_page' = 20,
'post_type' = 'product' ,
'tax_query' = array(
array(
'taxonomy' = 'style',
'terms' = $term
)
)
);
$wc_query = new WP_Query($params); // (2)
?
?php if ($wc_query-have_posts()) : // (3) ?
?php while ($wc_query-have_posts()) : // (4)
$wc_query-the_post(); // (4.1) ?
div class=col-md-3 style__col
?php the_post_thumbnail(); ?
h3 class=loop-subcategory__title style__title ?php the_title(); // (4.2) ? /h3
a class=loop-subcategory__view btn btn-primary style__view href=?php the_permalink(); ?View Product/a
/div
?php endwhile; ?
?php wp_reset_postdata(); // (5) ?
?php else: ?
p
?php _e( 'No Products' ); // (6) ?
/p
Topic woocommerce-offtopic Wordpress
Category Web