# Find in Store for Whippy Ware

This document provides a detailed guide on implementing and utilizing the **Find in Store** feature with Whippy Ware, designed to enhance customer experience by allowing users to check the availability of a product in specific stores. This feature integrates with brand-specific stock services and provides real-time stock information across retail locations.

To utilize this functionality, the relevant stock settings must first be configured in the Omnitron. Specific implementations of the RetailStockGateway class are required for each brand, ensuring compatibility with their unique stock services.

## <mark style="color:red;">Retail Stock Gateway</mark>

To query which store a product is available in, a stock setting must first be configured for the relevant Commerce channel through the *Omnitron > Sales Channels > Sales Channel Settings > Store Stock Settings* screen. For more details, refer to the [How to Manage Store Stock Settings?](https://app.gitbook.com/s/IbwGN7KwvYi0iLbjtnXz/omnitron/sales-channels/sales-channel-settings/how-to-manage-store-stock-settings) documentation.

<figure><img src="https://2911598027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlQinVPnOffBiOp126ldR%2Fuploads%2Fgit-blob-ec6ff4aee24e4aacc288371ceb556d2a52d0a8a4%2Fimage.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

**To integrate Whippy Ware, you must create a Retail Stock Gateway using the API endpoint below:**

## `POST` Create a Retail Stock Gateway for Whippy Ware

This endpoint is used to create a retail stock gateway that integrates with Whippy Ware to fetch and manage retail stock information.

**Path:** `{omnitron_url}/api/v1/remote/1/retail_stock_gateways/`

**Headers:**

* **Authorization**: `Token <OMNITRON_ACCESS_TOKEN>`

#### **Example Request**

The request must include the following fields. Ensure the URLs in the configuration point to Whippy Ware's backend (BE).

```javascript
{
    "name": "Retail Store Stock Service Name",
    "conf": {
        "urls": {
            "query_store_stock_url": "{whippy_ware_be_url}/api/v1/stocks/?sku={}"
        },
        "login_url": "{whippy_ware_be_url}/api/v1/auth/login/",
        "auth_params": {
            "username": "omnitron_user_username",
            "password": "omnitron_user_password"
        }
    },
    "gateway": "whippy",
    "is_active": true
}
```

<table><thead><tr><th width="130.140625">Field</th><th width="120.796875">Type</th><th width="377.6796875">Description</th><th>Required</th></tr></thead><tbody><tr><td><code>name</code></td><td><code>string</code></td><td>The name of the retail stock service.</td><td>Yes</td></tr><tr><td><code>conf</code></td><td><code>object</code></td><td>Configuration details for the gateway. See below for its structure.</td><td>Yes</td></tr><tr><td><code>gateway</code></td><td><code>string</code></td><td>The identifier for the gateway type (<code>whippy</code>).</td><td>Yes</td></tr><tr><td><code>is_active</code></td><td><code>boolean</code></td><td>Indicates whether the gateway should be active.</td><td>Yes</td></tr></tbody></table>

**Configuration Object (`conf`):**

The `conf` object contains detailed settings for the stock gateway:

<table><thead><tr><th width="181.3203125">Field</th><th width="101.0546875">Type</th><th width="380.61328125">Description</th><th>Required</th></tr></thead><tbody><tr><td><code>urls.query_store_stock_url</code></td><td><code>string</code></td><td>Whippy Ware BE URL for querying stock data. Use <code>{sku}</code> as a placeholder for a stock-keeping unit.</td><td>Yes</td></tr><tr><td><code>login_url</code></td><td><code>string</code></td><td>Whippy Ware BE URL for the authentication endpoint.</td><td>Yes</td></tr><tr><td><code>auth_params.username</code></td><td><code>string</code></td><td>Omnitron user’s username for authentication.</td><td>Yes</td></tr><tr><td><code>auth_params.password</code></td><td><code>string</code></td><td>Omnitron user’s password for authentication.</td><td>Yes</td></tr></tbody></table>

#### **Example Response**

```json
{
    "pk": 100,
    "name": "Retail Store Stock Service Name",
    "conf": {
        "urls": {
            "query_store_stock_url": "{whippy_ware_be_url}/api/v1/stocks/?sku={}"
        },
        "login_url": "{whippy_ware_be_url}/api/v1/auth/login/",
        "auth_params": {
            "username": "omnitron_user_username",
            "password": "omnitron_user_password"
        }
    },
    "gateway": "whippy",
    "is_active": true
}
```

## `GET` Product Store Stock Query

Once the Omnitron configuration is complete, users can query the store stock information for a product using the following Commerce endpoint:

**Path:** `{commerce_url}/retail_store_stock/{product_id}/`

Whippy stock location `code` must match the `erp_code` specified during the creation of a store in Omnitron. This ensures accurate alignment of stock data between systems.

Omnitron > Store Management > Stores > Add/Edit Store > **ERP Code** parameter:

<figure><img src="https://2911598027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlQinVPnOffBiOp126ldR%2Fuploads%2Fgit-blob-eefe1a2f52614f577dad224575f4a785a372742c%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Whippy Ware > Stock Locations > Create Stock Location > **Code** parameter:

<figure><img src="https://2911598027-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlQinVPnOffBiOp126ldR%2Fuploads%2Fgit-blob-1d41da0ef42cc5a5095b01d8609a00093d745498%2Fimage%20(94).png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Example Response**

The response is generated through the implemented **Retail Stock Gateway**, as described above.

The fields include:

<table><thead><tr><th width="173.46875">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>pk</code></td><td>Primary key of the store, serving as a unique identifier.</td></tr><tr><td><code>name</code></td><td>The name of the store.</td></tr><tr><td><code>township</code></td><td>Details of the township where the store is located, including its city and country information.</td></tr><tr><td><code>district</code></td><td>The district where the store is located.</td></tr><tr><td><code>address</code></td><td>The full address of the store.</td></tr><tr><td><code>phone_number</code></td><td>Contact phone number for the store.</td></tr><tr><td><code>image</code></td><td>URL or reference to the store's image, if available.</td></tr><tr><td><code>store_hours</code></td><td>Operating hours of the store, typically presented as a list.</td></tr><tr><td><code>latitude</code></td><td>Geographical latitude coordinate of the store's location.</td></tr><tr><td><code>longitude</code></td><td>Geographical longitude coordinate of the store's location.</td></tr><tr><td><code>is_active</code></td><td>Boolean indicating whether the store is currently active.</td></tr><tr><td><code>click_and_collect</code></td><td>Boolean indicating whether the store supports the click-and-collect service.</td></tr><tr><td><code>store_type</code></td><td>Type of the store.</td></tr><tr><td><code>kapida_enabled</code></td><td>Boolean indicating whether the store supports door delivery.</td></tr><tr><td><code>fast_delivery</code></td><td>Boolean indicating whether the store offers fast delivery options.</td></tr><tr><td><code>config</code></td><td>Configuration data specific to the store, usually presented as a key-value object.</td></tr><tr><td><code>group</code></td><td>The group or category the store belongs to.</td></tr><tr><td><code>sort_order</code></td><td>Determines the display order of the store in a list.</td></tr><tr><td><code>created_date</code></td><td>The date and time when the store record was created.</td></tr><tr><td><code>modified_date</code></td><td>The date and time when the store record was last updated.</td></tr><tr><td><code>erp_code</code></td><td>The store's unique code in the ERP system.</td></tr><tr><td><code>translations</code></td><td>Multilingual translations of the store’s attributes, if applicable.</td></tr><tr><td><code>related_retail_stores</code></td><td>List of other retail stores related to this store.</td></tr><tr><td><code>absolute_url</code></td><td>The absolute URL to the store's detail page or resource in the system.</td></tr></tbody></table>

```json
[
  {
    "pk": 1,
    "name": "CITY AVM",
    "township": {
      "pk": 1,
      "is_active": true,
      "name": "xxx",
      "city": {
        "pk": 1,
        "is_active": true,
        "name": "xxx",
        "country": {
          "pk": 1,
          "is_active": true,
          "name": "xxx",
          "code": "byt",
          "translations": null
        }
      }
    },
    "district": null,
    "address": "xxx",
    "phone_number": "xxx",
    "fax_phone_number": null,
    "image": null,
    "store_hours": [
      ["09:00:00", "18:00:00"],
      ["09:00:00", "18:00:00"],
      ["09:00:00", "18:00:00"],
      ["09:00:00", "18:00:00"],
      ["09:00:00", "18:00:00"],
      ["09:00:00", "18:00:00"],
      [null, null]
    ],
    "latitude": null,
    "longitude": null,
    "is_active": true,
    "click_and_collect": false,
    "store_type": null,
    "kapida_enabled": false,
    "fast_delivery": false,
    "config": {},
    "group": null,
    "sort_order": null,
    "created_date": "2024-12-16T10:20:51.542582Z",
    "modified_date": "2024-12-16T10:20:51.542601Z",
    "erp_code": "M34",
    "translations": null,
    "related_retail_stores": [],
    "absolute_url": "/address/retail_store/1/",
    "stock": 1,
    "remote_store_name": "CITY REAL STORE"
  }
]
```
