Add search file to enable the Quote function in the front store
Estimated reading: 2 minutes
16 views
In order to get the Quote function of SA Request a Quote app to work in your theme, you need to manually add a search file for the app to enable the app data in your theme. Kindly review this document to know how to set it up.
- From the Shopify admin page, choose the Online Store folder > Themes
- In Themes > choose the More actions button > Edit code
3. On the code page, click on “Add a new template” > choose Template type: search > liquid > Fill in the file name as: rfq
4. Set Done.
5. Add the below codes to the file:
{%- layout none -%}
{%- if search.terms contains 'handles:' -%}
[
{%- assign params = canonical_url | url_decode | split: "?" | last | split: "&" -%}
{%- assign handles = '' -%}
{%- for str in params -%}
{%- assign str_split = str | split: "=" -%}
{%- if str_split.first == 'q' -%}
{%- assign handles = str_split.last | remove_first: "handles:" -%}
{%- endif -%}
{%- endfor -%}
{%- if handles != '' -%}
{%- assign handles = handles | split: "|" -%}
{%- for handle in handles limit:20 -%}
{%- assign product = all_products[handle] -%}
{%- unless forloop.first -%},{%- endunless -%}
{%- if product.id != '' -%}
{
"available": {{product.available}},
"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 }}",
"images": {{ product.images | json }},
"collection": {{ product.collections | map: 'id' | json }} }
{%- else -%}
null
{%- endif -%}
{%- endfor -%}
{%- endif -%}
]
{%- endif -%}
6. Click Save to finish creating this new file.
- IMPORTANT step: Go back to the Sami Wholesale app, and open the Theme integration section so the latest codes are being pushed to the theme/app data. Please read this document to know how to manage it.