Hello there,
I hope you’re doing well :D.
I checked and maybe the problem is that you are using a custom page also for categories.
Could you make a test and disable all plugins leaving only WooCommerce and YITH WooCommerce Ajax Product Filter and try again?
Also try using a default theme like TwentySixteen.
I’m looking forward your response.
Have a good day.
Yeah i’m using a custom page for categories.. is this not supported?
Hello there,
I hope you’re doing well :D.
Could you try to add the following code in the functions.php of your active theme
if( ! function_exists( 'yith_wcan_set_query_vars' ) ){
function yith_wcan_set_query_vars(){
if ( ! function_exists( 'YITH_WCAN_Query' ) ) {
return;
}
$qo = get_queried_object();
$query_vars = YITH_WCAN_Query()->get_query_vars();
if ( is_product_taxonomy() && $qo instanceof WP_Term && ! isset( $query_vars[ $qo->taxonomy ] ) ) {
YITH_WCAN_Query()->set( $qo->taxonomy, $qo->slug );
} elseif ( is_page() && $qo instanceof WP_Post && ! isset( $query_vars['product_cat'] ) ) {
$page_slug = $qo->post_name;
$related_term = get_term_by( 'slug', $page_slug, 'product_cat' );
if ( $related_term && ! is_wp_error( $related_term ) ) {
YITH_WCAN_Query()->set( 'product_cat', $related_term->slug );
}
}
}
add_action( 'wp', 'yith_wcan_set_query_vars' );
}
It should retrieve the current category and should work for custom pages.
Please, try it and let me know.
Have a good day.
Thanks, but this give me an error in WordPress:
Parse error: syntax error, unexpected token “;”, expecting “)” in /home/new.masterphil.it/public_html/wp-content/themes/Avada-Child-Theme/functions.php on line 84
Hello there,
I hope you’re doing well 😀
I checked the code and seems to work fine for me. Maybe you made an error on copy paste. Try to add it at the end of the functions.php file.
Please, try it and let me know.
Hi, probably I pasted it wrong. I don’t have the error now, but it’s still not working like before, showing only “Shop” or “No terms found”