Hello,
I’m trying to filter on product variant size. But the Isn’t displaying the wanted output.
filter.value.count
It shows the amount of products that contains these variants. I want it to show as the following:
[PRODUCT_SIZE] ([VARIANT_AVAILABILITY])
Hi @dylandold ,
You need to find the location to render the product variant in your code (depending on the theme you are using).
To get the remaining quantity of the variant you can use {{product.variants[index].inventory_quantity}} where index is the variant’s serial number starting from 0.
If your theme is similar to dawn theme you can use the code below.
Here is the code:
{%- for variant in product.variants -%}
{% if variant.title == value-%}
{{ ' ' }} ({{variant.inventory_quantity}} )
{%- endif -%}
{%- endfor -%}
Result:
Hey thanks for your response.
But im still struggling with showing the correct results by applying the filter. It’s also showing all the products because of the filter not being working as expected.