Filter by availability not working | filter.v.availability = 1

Topic summary

Issue: An AJAX-based product filter is not restricting results to in‑stock variants for a selected color. Adding the URL parameter filter.v.availability=1 does not change results; items with unavailable variants still appear.

Context: The backend indicates certain variants are out of stock, yet they are returned by the filter. The user tested by appending the availability parameter to the collection URL.

Evidence: Multiple screenshots (code, URL parameters, frontend results comparison, and backend inventory status) are central to understanding the mismatch between expected and actual results.

Technical notes: “Variants” are specific option combinations of a product (e.g., color). “filter.v.availability=1” is intended to restrict results to available (in‑stock) variants. AJAX refers to asynchronous requests fetching filtered collection data.

Response: A suggestion was offered to avoid external libraries/jQuery and instead use vanilla JavaScript fetch, applying filter parameters directly in the request and handling filtering in code.

Status: No concrete fix or confirmation of why filter.v.availability=1 fails was provided. The issue remains unresolved, with an open question on how to correctly enforce availability filtering for variants via the URL parameter or AJAX.

Summarized with AI on February 14. AI used: gpt-5.

Hi!

I am having a really hard time trying to figure out why my ajax filter does not return only available variants in a specific color.

The backend seems fine and when I check if the variant of a specific product that was returned is available it does not seem to be in stock.

I tried adding filter.v.availability=1 to my URL parameter and it does not make a difference.

Also, I’ve seen that @made4Uo is an active member, can you help me in any way?

My ajax filter code is below:

Then the parameter URL:

The response on collection page (the right one is okay the left one is wrong):

And the backend for the wrong product:

Hi @m4tt133 ,

Sorry, I write codes from scratch. I don’t use external libraries, and jquery. You can always achieve this using vanilla javascript fetch and run the filter there using params