Products and Categories
-
Hi, we used to use this code
/* Enter your custom functions here */
function exclude_product_cat_children($wp_query) {
if ( isset ( $wp_query->query_vars[‘product_cat’] ) && $wp_query->is_main_query()) {
$wp_query->set(‘tax_query’, array(
array (
‘taxonomy’ => ‘product_cat’,
‘field’ => ‘slug’,
‘terms’ => $wp_query->query_vars[‘product_cat’],
‘include_children’ => false
)
)
);
}
}
add_filter(‘pre_get_posts’, ‘exclude_product_cat_children’);add_filter( ‘woocommerce_subcategory_count_html’, ‘jk_hide_category_count’ );
function jk_hide_category_count() {
// No count
}To show products only in the category they were in and not in the parent while showing categories in the shop too.
With the recent changes Woocommerce did that code doesn’t work.
Anyone know how we can do what we want now?(excuse my english)
Thanks in advance
StylianosThe page I need help with: [log in to see the link]
- The topic ‘Products and Categories’ is closed to new replies.