# Add search file to enable app data in your theme

## **How to** search file in your theme ?

In order to get the Sami Wholesale 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.&#x20;

1. From the Shopify admin page, choose the **Online Store** folder > **Themes**
2. In **Themes** > choose the **More actions** button > **Edit code**

<figure><img src="https://810149679-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7AXvWN0Sv4Sg8s2aVRWp%2Fuploads%2FBLtT41Ew8QS20SEyIlxR%2Fimage.png?alt=media&#x26;token=411862a8-4a9b-42e5-a1f5-7945c405d20b" alt=""><figcaption></figcaption></figure>

3. On the code page, right-click on the **Template** tab > Choose **New file** to create this search file.&#x20;

<figure><img src="https://810149679-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7AXvWN0Sv4Sg8s2aVRWp%2Fuploads%2F4i9xK49vCsOYkjW3NceM%2Fimage.png?alt=media&#x26;token=35010937-4e04-44bb-84f6-987635045e96" alt=""><figcaption></figcaption></figure>

Then set up name for this file like this: **search.samitaWSProductsJson.liquid**

<figure><img src="https://810149679-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7AXvWN0Sv4Sg8s2aVRWp%2Fuploads%2F2e2CtletHbdkh3B1OxHL%2Fimage.png?alt=media&#x26;token=15ead78b-8dc4-48cf-acfc-c7e7feb26f71" alt=""><figcaption></figcaption></figure>

4. Add the below codes to the file:&#x20;

```
{%- layout none -%}
{%- paginate search.results by 250 -%}
    [{%- for product in search.results -%}
        {%- unless forloop.first -%},{%- endunless -%}
        {
            "id":{{-product.id-}},
            "title":{{-product.title | json-}},
            "handle":"{{-product.handle-}}",
            "price":"{{-product.price-}}",
            "price_max":"{{-product.price_max}}",
            "price_min":"{{-product.price_min}}",
            "product_type":"{{-product.product_type-}}",
            "created_at":"{{-product.created_at-}}",
            "published_at":"{{-product.published_at-}}",
            "tags": {{-product.tags | json-}},
            "vendor": "{{-product.vendor-}}",
            "featured_image":"{{-product.featured_image-}}",
            "url":"{{-product.url-}}",
            "collections":{{-product.collections | map: 'id' | json-}},
            "compare_at_price":"{{-product.compare_at_price-}}",
            "compare_at_price_max": "{{-product.compare_at_price_max-}}",
            "compare_at_price_min": "{{-product.compare_at_price_min-}}",
            "options": {{-product.options | json-}},
            "options_with_values": {{-product.options_with_values | json-}},
            "images":[
            {%- for image in product.images -%}{%- unless forloop.first -%},
            {%- endunless -%}
            {
                "id":{{-image.id-}},
                "src":{{-image.src | json-}},
                "variant_ids":{{-image.variants | json-}}
            }
            {%- endfor -%}
            ],
            "first_available_variant":{"id":{{product.selected_or_first_available_variant.id}}},
            "available":{{-product.available-}},
            "variants":[
                {%- for variant in product.variants -%}{%- unless forloop.first -%},
                    {%- endunless -%}
                    {
                    "id":{{-variant.id-}},
                    "title":{{-variant.title | json}},
                    "name":{{-variant.name | json}},
                    "price":{{-variant.price-}},
                    "compare_at_price":"{{-variant.compare_at_price-}}",
                    "available":{{-variant.available-}},
                    "vendor": "{{-variant.vendor-}}",
                    "sku":{{-variant.sku | json -}},
                    "weight":"{{-variant.weight-}}",
                    "image_id": "{{-variant.image_id-}}",
                    "weight_unit": "{{-variant.weight_unit-}}",
                    "option1":  {{-variant.option1| json-}},
                    "option2":  {{-variant.option2| json-}},
                    "option3":  {{-variant.option3| json-}},
                    "options":  {{-variant.options| json-}},
                    "inventory_quantity":{{-variant.inventory_quantity-}},
                    "inventory_policy": {{-variant.inventory_policy | json -}}
                    }
                {%- endfor -%}
            ]
        }
    {%- endfor -%}]
{%- endpaginate -%}
```

<figure><img src="https://810149679-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7AXvWN0Sv4Sg8s2aVRWp%2Fuploads%2F6Etp6uRRW9LHNh0R5RSj%2Fimage.png?alt=media&#x26;token=cdcfdcc3-c390-4690-bc92-3745b20f52ff" alt=""><figcaption></figcaption></figure>

<figure><img src="https://810149679-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7AXvWN0Sv4Sg8s2aVRWp%2Fuploads%2FyI9ySaNLGpaL6uBGgpbp%2Fimage.png?alt=media&#x26;token=468ad5dd-e337-4438-bdfb-27a9b39eb95b" alt=""><figcaption></figcaption></figure>

5. Click **Save** to finish creating this new file.

## Tutorial Video

{% embed url="<https://www.youtube.com/watch?v=AThxMwLRvBo>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.samita.io/samita-wholesale-b2b/mandatory-steps/add-search-file-to-enable-app-data-in-your-theme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
