I am experiencing a problem with the product filters on our WooCommerce shop using XStore. When filtering by product attributes (e.g., size, color, season), the filters do not respect stock status correctly.
Current behavior:
A product is displayed in the filtered results even if the specific variation selected by the filter is out of stock.
For example, if a product has two size variations, one in stock and one out of stock, and the user selects the out-of-stock size, the product still appears.
If multiple filters are selected (e.g., sizes 37 and 38), the filter logic behaves inconsistently and may return products even if none of the selected variations are actually in stock.
Expected behavior:
Products should only appear if there is at least one variation in stock that matches the selected filter(s).
Out-of-stock variations should be excluded from the filtered results.
Multiple filters should work using OR logic across variations, so if at least one variation meets the selected criteria, the product is shown.
Additional notes:
I am using custom pre_get_posts hooks to try to fix this, but the default XStore attribute filters do not handle this correctly out of the box.
The issue is affecting filters for attributes like pa_razmer (size), pa_tsvet (color), and pa_sezon (season).
Please advise on a solution or update to ensure that attribute filters only show products with available variations matching the selected criteria.