Hi,
I’m trying to add a filter to my search that will prevent products with a remaining quantity of 1 or less from appearing as suggested products.
I’ve tried to following code but it has not had an effect unfortunately.
{% for item in search.results %}
{% if item.object_type == 'product' -%}
{% if item.product.inventory_quantity > 1 %}
{%- render 'product-item', product: product, list: show_as_list, grid_classes: grid_classes -%}
{% endif %}
{%- endif -%}
{% endfor %}
I’m using the Warehouse theme. Does anyone have any suggestions on how to implement this?
Thanks,
Calum