> For the complete documentation index, see [llms.txt](https://docs.suggestic.com/graphql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.suggestic.com/graphql/query/mutations/shopping-list/shopping-list-1.md).

# Add a Recipe to the Shopping List

Use `addToShoppingList` to add a recipe to the user's shopping list

#### Available Argument

| Arguments  | Type  | Description                              |
| ---------- | ----- | ---------------------------------------- |
| `recipeId` | UUID! | recipe database **UUID**                 |
| `servings` | Int   | Number of recipes to add for the recipe. |

### Available Fields

| **Field Name** | **Type** |                                          **Description**                                         |
| :------------: | :------: | :----------------------------------------------------------------------------------------------: |
|    `success`   |  Boolean | **True** if the recipe has been added to the shopping list. Otherwise, it will display **False** |
|    `message`   |  String  |                 Description of the result. Either if the recipe was added or not.                |

### Example

The following example adds the Fried Rice recipe to the shopping list.

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

```graphql
mutation {
  addToShoppingList(recipeId: "bd2f4b0c-83fc-4a45-8b2c-862bb31c85a9") {
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "addToShoppingList": {
      "success": true,
      "message": "Recipe successfully added"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Example with Servings

The following example adds one serving of the Fried Rice recipe to the shopping list.

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

```graphql
mutation {
  addToShoppingList(
    recipeId: "bd2f4b0c-83fc-4a45-8b2c-862bb31c85a9"
    servings: 1
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "addToShoppingList": {
      "success": true,
      "message": "Recipe successfully added"
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If a shopping list is created from a LOW variety meal plan, we suggest using the following logic.

* If a recipe is present only once in the meal plan —> add the recipe to the shopping list using the default number of servings of the recipe.
* If a recipe is present more than one time in the meal plan:
  * if recipe's default number of servings (i.e. 2) < number of times the recipe appears (ie. 3) —> add recipe to shopping list with the number of servings equal to how many times it shows up on the meal plan (ie. 3).
  * if recipe's default number of servings (i.e. 4) >= number of times the recipe appears (i.e. 2) —> add recipe with default number of servings.
    {% endhint %}

### UI/UX example

This is an implementation example from the Suggestic App.&#x20;

![](/files/4yAQ7WTcbOhOv2dbOEx9)

## Add Multiple Recipes to a Shopping list

#### Available Argument

| Arguments   | Type         | Description                  |
| ----------- | ------------ | ---------------------------- |
| `recipeIds` | **`[UUID]`** | List of recipe database UUID |

### Example

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

```graphql
mutation {
  addRecipesToShoppingList(recipeIds: [
    "26400c11-125d-4782-b83c-6c74923ae9ab",
    "4719210c-fff5-4709-b6d2-7b460102843d"
  ]) {
    message
    success
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "addRecipesToShoppingList": {
      "message": "Recipes successfully added",
      "success": true
    }
  }
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.suggestic.com/graphql/query/mutations/shopping-list/shopping-list-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
