Hello Itmesteren,
It’s true that filters hook into all the Woocommerce queries that are run on shop page, including those belonging to shortcodes. Problem is, sometimes this behavior is desirable: some builders and themes re-write the main Woocommerce loop, but whenever they use native Woocommerce hooks, the filters still work. Quite a few of existing plugin users rely on this functionality, so unfortunately we are rather reluctant to revise this piece of code.
Could you perhaps consider using the native Woocommerce “Products by Category” widget instead of the shortcode to display the contents of your header category? Filters should not interfere with the work of this widget, and it has an absolutely different HTML markup to not get affected by AJAX calls.
If the usage of “Products by Category” widget solution is not agreeable for whatever reason and you have a child theme and are willing to resolve the issue by custom adjustments, here is what you can do:
1. Go to the annasta Filters > Product lists admin section, and set the Products html wrapper setting to a unique identifier for the wrapping container of the main (filterable) products list of your shop page (click on the link above for explanations on how to find the wrapper).
2. Add the following code at the end of the functions.php file of your child theme:
function annasta_remove_shop_page_shortcodes_support( $attrs ) {
if( is_shop() && class_exists( 'A_W_F' ) && !empty( A_W_F::$front ) ) {
remove_filter( 'woocommerce_product_query_tax_query', array( A_W_F::$front, 'set_wc_tax_query' ) );
remove_filter( 'woocommerce_product_query_meta_query', array( A_W_F::$front, 'set_wc_meta_query' ) );
remove_filter( 'loop_shop_post_in', array( A_W_F::$front, 'get_wc_post__in' ) );
}
return $attrs;
}
add_filter( 'shortcode_atts_products', 'annasta_remove_shop_page_shortcodes_support' );