# Shopping List by Recipes

A shopping list in Suggestic is a collection of ingredients originating from recipes previously added to the list using the [addToShoppingList ](https://docs.suggestic.com/graphql/query/mutations/shopping-list/shopping-list)mutation.&#x20;

Use the `shoppingList` query to obtain the list of recipes added to the shopping list.

### Available Fields

| Field                                                                       | Type    | Note                                                                                                                                             |
| --------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ingredient`                                                                | String  | Item in the shopping list                                                                                                                        |
| `quantity`                                                                  | String  | Quantity of the ingredient (item)                                                                                                                |
| `floatQuantity`                                                             | Float   | Item quantity as float                                                                                                                           |
| [`aisleName`](https://docs.suggestic.com/graphql/objects/common/aisle-name) | String  | Name of the aisle in which the ingredient (item) can be found. See options [here](https://docs.suggestic.com/graphql/objects/common/aisle-name). |
| `recipeName`                                                                | String  | Name of the recipe                                                                                                                               |
| `isDone`                                                                    | Boolean | True if the item is checked                                                                                                                      |

### Example

#### GraphQL Example

{% tabs %}
{% tab title="Query" %}

```graphql
{
  shoppingList {
    edges {
      node {
        ingredientLine
        quantity
        aisleName
        recipeName
        isDone
        unit
        databaseId
      }
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "shoppingList": {
      "edges": [
        {
          "node": {
            "ingredientLine": "16.4 grams non-diatatic malt powder (or barley malt syrup, or even brown sugar)",
            "quantity": "16.4",
            "aisleName": "Other",
            "recipeName": "Sourdough Bagels",
            "isDone": false,
            "unit": "grams",
            "databaseId": "05567b8f-ec1c-4f9d-8ed4-43ced7d36d26"
          }
        },
        {
          "node": {
            "ingredientLine": "1/2 cup pure cane syrup",
            "quantity": "1/2",
            "aisleName": "Other",
            "recipeName": "Glazed Turnips",
            "isDone": false,
            "unit": "cup",
            "databaseId": "57cd3daa-8499-47be-a126-be8eae7e1a4c"
          }
        },
        {
          "node": {
            "ingredientLine": "olive oil",
            "quantity": null,
            "aisleName": "Fats and Oils",
            "recipeName": "Glazed Turnips",
            "isDone": false,
            "unit": null,
            "databaseId": "195c0e2f-302f-4f65-8982-aa13fee2f8d5"
          }
        },
        {
          "node": {
            "ingredientLine": "1 tablespoon mccormick's montreal seasoning",
            "quantity": "1",
            "aisleName": "Other",
            "recipeName": "Glazed Turnips",
            "isDone": false,
            "unit": "tablespoon",
            "databaseId": "1440ca08-396a-4b58-a0b4-8ed9ed98c532"
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

#### cURL Example

{% tabs %}
{% tab title="Request" %}

```json
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"{  shoppingList { edges {node {ingredientLine quantity aisleName recipeName isDone unit  databaseId  errors   }  }  }}"}'

```

{% endtab %}
{% endtabs %}

#### UI/UX example

In the same way, we have code examples, this is an implementation example in which see results of the API execution in the Suggestic App.&#x20;

Login to the App, tap on the **Meal Plan** option, and tap on the <img src="https://920729701-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwqSnBDpAb6mFZYLsuB%2F-MkJ0j98q9gdDacGYf7u%2F-MkJ7tzZGCrCk6vFSuKk%2Fimage.png?alt=media&#x26;token=1c74db95-97ca-4909-a816-d175e26565cd" alt="" data-size="line"> icon to access the Shopping List, Tap on **By Recipe** tab and see the list of recipes added.

![](https://920729701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LwqSnBDpAb6mFZYLsuB%2Fuploads%2FICduMPVONxL6MpAJmsp0%2FGetShoppingList.gif?alt=media\&token=14b95e33-06f9-428d-94c1-f16dd5c77ff5)

## Get Shopping List Aggregate

Use `shoppingListAggregate` to obtain the ingredients for the recipe added to the shopping list. If more than one recipe is added to the shopping list, this will show the cumulative ingredients.

### Available Fields

| Field        | Type   | Note                                                                                      |
| ------------ | ------ | ----------------------------------------------------------------------------------------- |
| `ingredient` | String | Item in the shopping list                                                                 |
| `quantity`   | String | Item (ingredient) quantity                                                                |
| `aisleName`  | String | Name of the aisle in which the ingredient (item) can be found                             |
| `unit`       | String | Unit of measurement. Possible Values: `cup`, `spoon`, `ounces`, `teaspoon`, `tablespoon.` |
| `grams`      | Float  | Recipe measurement. Use this value as a reference only.                                   |
| `isDone`     | Bool   | True if the item is checked                                                               |

### Example

#### GraphQL Example

{% tabs %}
{% tab title="Query" %}

```graphql
query {
  shoppingListAggregate {
    edges {
      node {
        databaseId
        ingredient
        aisleName
        quantity
        unit
        grams
        isDone
      }
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "shoppingList": {
      "edges": [
        {
          "node": {
            "databaseId": "856f3e88-ebde-4dc8-a38b-af3dd4c8a291",
            "ingredient": "olive oil",
            "aisleName": "Pantry",
            "quantity": "1/2",
            "grams": 2.25,
            "isDone": false
          }
        },
        {
          "node": {
            "databaseId": "9bfdfe98-6cb2-4293-9146-c8298c06a243",
            "ingredient": "avocado",
            "asileName": "Pantry",
            "quantity": "1",
            "grams": 201,
            "isDone": false
          }
        }
      ]
    },
    "shoppingListAggregate": {
      "edges": [
        {
          "node": {
            "databaseId": "23cb01bf-50be-40cb-871d-954baa15fa79",
            "ingredient": "salt",
            "aisleName": "Pantry",
            "quantity": 6,
            "unit": "dash",
            "grams": 2.25,
            "isDone": false
          }
        },
        {
          "node": {
            "databaseId": "dcbd2ca8-d455-4944-895f-784825cc18ed",
            "ingredient": "avocado",
            "aisleName": "Pantry",
            "quantity": 2,
            "unit": "cup, pureed",
            "grams": 402,
            "isDone": false
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

#### cURL Example

{% tabs %}
{% tab title="Request" %}

```json
curl -XPOST 'https://production.suggestic.com/graphql' \
  -H 'Authorization: Bearer <User-JWT>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"query":"{  shoppingListAggregate  { edges {node {databaseId ingredient aisleName quantity unit grams  isDone   }  }  }}"}'

```

{% endtab %}
{% endtabs %}

#### UI/UX example

In the same way, we have code examples, this is an implementation example in which see results of the API execution in the Suggestic App.&#x20;

Login to the App, tap on the **Meal Plan** option, and tap on the <img src="https://920729701-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwqSnBDpAb6mFZYLsuB%2F-MkJ0j98q9gdDacGYf7u%2F-MkJ7tzZGCrCk6vFSuKk%2Fimage.png?alt=media&#x26;token=1c74db95-97ca-4909-a816-d175e26565cd" alt="" data-size="line"> icon to access the Shopping List, Tap on **By Aisle** tab and see the list of ingredients per each recipe:

![](https://920729701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LwqSnBDpAb6mFZYLsuB%2Fuploads%2FEUSkNw9RG8OpR4DJJoMU%2FSPAggregate.gif?alt=media\&token=8ba6dad7-1a29-40d0-b76b-97a5ac9c3ec4)
