{%- if predictive_search.performed -%}
{
"results_count": {{ predictive_search.resources.products.size }},
"products": [
{%- for product in predictive_search.resources.products -%}
{%- unless forloop.first -%},{%- endunless -%}
{%- if product.id != '' -%}
{
"available": {{ product.available | json }},
"id": {{ product.id }},
"handle": "{{ product.handle }}",
"options": {{ product.options | json }},
"variants": {{ product.variants | json }},
"price": {{ product.price }},
"tags": {{ product.tags | json }},
"title": {{ product.title | json }},
"type": {{ product.type | json }},
"url": "{{ product.url }}",
"vendor": {{ product.vendor | json }},
"featured_image": "{{ product.featured_image.src | image_url }}",
"collections": {{ product.collections | map: 'id' | json }}
}
{%- endif -%}
{%- endfor -%}
]
}
{%- else -%}
{ "results_count": 0, "products": [] }
{%- endif -%}