---
# System prepended metadata

title: 'Change Request: Allergies'

---

# Change Request: Allergies

#### Quick data:
**Client interested**: Tower42
**Module involved**: Marketplace / Multishop
**Platforms involved**: All (!)
**Status**: draft
**Deadline**: 2nd half of August (as to allow ample time for testing prior T42 launch scheduled for mid September)


#### Business Case

Restaurant products can cause allergic reactions in certain cases. In many restaurant / food ordering apps such products are labeled with a clear indication / warning what allergene types they contain. T42 restaurants require SpaceOS merchant app to include such feature prior planned launch on **mid September**.

#### Proposed Technical solution - overview

Backend & Merchant app will provide a method of tagging products from a closed catalogue of tags. These tags will later be shown next to the product name in all clients.

- Only products from shop[type=restaurant] will be taggable (at least for the time being)
- **To decide::** Tags catalogue would be defined 
    - Option 1: on per-shop basis. Meaning different shops will be able to change their catalogue of tags
    - Option 2: defined globally by spaceOS admin
>[color=magenta]
>### MM: I think the Support Ticket style approach is ideal. There's a generally agreed list of food allergens, so globally defined can be good enough for MVP. In ideal world we'd have a pre-set list that can be modified (it's OK if i)
    __in both cases spaceOS can provide initial set of tags (like the ones below) to save Merchants/Admins some time__
- tags will be of two types:
    - **allergies**: eggs, milk, soy, shellfish, peanuts, tree nuts, gluten
    - **traits**: e.g. vegan, vegetarian, halal, kosher etc.
>[color=magenta]
>### MM: That's a cool idea. Allergies are a real blocker now, traits are a good addition.

In case of tags being defined on per-shop basis, Merchant app may provide an interface to manage (CRUD) tag catalogue.

>[color=magenta] 
>### MM: I think that’d be needed for traits. we can make traits Phase 2

Tags are assignable to (restaurant) products via Product edit view in Merchant App.

Tags are visible in product list on all platforms, and on summary just prior order confirmation. 

## Business ToDo's

- Approve assumptions that we have 2 types of tags (allergies/traits), and that tags are available only for restaurants

>[color=magenta]  **Decision**: allergies - must have; traits - nice to have

- Decide whether the tag lists should be defined globally or on per-shop basis

>[color=magenta]  **Decision**: tags are defined globally


## Backend ToDo's

1.Provide Tags model. (fields: type and caption) and CRUD for the API

2.Tags should be returned in serializers with product details, and product lists

For Merchant App

`GET /api/v4/merchant/shops/{id}/products`

and for regular users:

`GET /api/v4/admin/shops`

like this:
```json=
    "products": [
        {
            "id": 1,
            "name": "Veuve Clicquot Ponsardin Brut 0,75l",
            "description": "",
            "sku": "112233",
            "position": 1,
            "shop_product_category_id": 1,
            "photo": {
                "web": {
                    "medium": "https://wms-media-local.s3.amazonaws.com/system/pictures/images/000/000/254/web_medium/26274f1009da2f273e9e7871e4c825e33ba432d1.jpg"
                },
                "mobile": {
                    "small": "https://wms-media-local.s3.amazonaws.com/system/pictures/images/000/000/254/mobile_small/865251470aea3e0568012d877bfe2c25e75a1639.jpg",
                    "medium": "https://wms-media-local.s3.amazonaws.com/system/pictures/images/000/000/254/mobile_medium/30b01821e25687b92842ffe9d0a2759a5fed11a8.jpg",
                    "large": "https://wms-media-local.s3.amazonaws.com/system/pictures/images/000/000/254/mobile_large/30ff5c4df1492b93c1c3755b77b56a02f11d99ad.jpg"
                },
                "id": 254
            },
            "net_price": 20,
            "tax_rate": 23,
            "tax_value": "460.0",
            "gross_price": "480.0",
            "tags": [
                {
                    "id": 1,
                    "type": "allergy",
                    "caption": "gluten"
                },
                {
                    "id": 2,
                    "type": "trait",
                    "caption": "vegetarian"
                },
                {
                    "id": 3,
                    "type": "trait",
                    "caption": "kosher"
                }
            ]
        }
    ]
```




3. Provide ability to assign tags to products (if shop[type=restaurant])

`(being merchant) PATCH/PUT api/v4/merchant/shops/1/products/27`

```jsonld=
    {
        "product": {
            "tag_ids": [11,12,13]
        }
    }
```
or with FORM DATA:
```
product[tag_ids][0]     11
product[tag_ids][1]     12
product[tag_ids][2]     13
```

4. Provide dictionary endpoint with tags

`GET api/v4/merchant/shops/1/tags` or 
`GET api/v4/merchant/tags`

```jsonld=
{
    "tags": [
        {
            "id": 1,
            "type": "allergy",
            "caption": "gluten"
        },
        {
            "id": 2,
            "type": "trait",
            "caption": "vegetarian"
        },
        {
            "id": 3,
            "type": "trait",
            "caption": "kosher"
        }
}
```

## Merchant App ToDo's

- (? dependant on business decision - only if tags are per-shop) provide CRUD view for Tags

- Allow assigning tags to products in Product creation/edit view 

## Web App ToDo's

- display tags in product list view
- display tags in product basket/summary view
- (? dependant on business decision - only if tags are global and not per-shop) provide a CRUD view for tags


## Mobile App ToDo's

- display tags in product list view
- display tags in product basket/summary view