Browser: Google Chrome 138.0.7204.50
OS: Windows 11
Video: Jam
It seems that when using a PHP query, the Infinite Scroll and Filters get broken.
With a simple query, it seems to work, so I assume it’s because if the more complex query.
The PHP query:
$parent_product_category_id = '{url_parameter:kategorie-produktu}';
if ( ! is_product_tag() || ! ( $current_tag_object = get_queried_object() ) ) {
return [ 'post__in' => [0] ];
}
$tax_query = [
[
'taxonomy' => 'product_tag',
'field' => 'term_id',
'terms' => $current_tag_object->term_id,
],
];
if ( ! empty( $parent_product_category_id ) ) {
$child_category_ids = get_term_children( (int) $parent_product_category_id, 'product_cat' );
$category_ids_to_query = array_merge( [ (int) $parent_product_category_id ], $child_category_ids );
$tax_query['relation'] = 'AND';
$tax_query[] = [
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $category_ids_to_query,
'operator' => 'IN',
];
}
return [
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => 6,
'tax_query' => $tax_query,
];
Can you help with that?