Requires write_online_store_navigation access scope.

Updates a menu.


The menus's handle.

Anchor to id
id
required

ID of the menu to be updated.

List of the menus' items.

The menu's title.


Was this section helpful?

The updated menu.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) {
  menuUpdate(id: $id, title: $title, handle: $handle, items: $items) {
    menu {
      id
      handle
      items {
        id
        title
        items {
          id
          title
        }
      }
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) { menuUpdate(id: $id, title: $title, handle: $handle, items: $items) { menu { id handle items { id title items { id title } } } } }",
 "variables": {
    "id": "gid://shopify/Menu/442047006",
    "title": "updated menu",
    "handle": "danielstuff-main-menu",
    "items": [
      {
        "id": "gid://shopify/MenuItem/398712010",
        "title": "Electronics",
        "url": "collection/tables",
        "resourceId": "gid://shopify/Collection/71762467",
        "type": "COLLECTION",
        "items": [
  
        ]
      },
      {
        "id": "gid://shopify/MenuItem/643685044",
        "title": "Furniture",
        "url": "/collections/furniture",
        "resourceId": "gid://shopify/Collection/643685044",
        "type": "COLLECTION",
        "items": [
          {
            "id": "gid://shopify/MenuItem/927352226",
            "title": "Updated Living Room",
            "url": "/collections/living-room",
            "resourceId": "gid://shopify/Collection/927352226",
            "type": "COLLECTION",
            "items": [
              {
                "id": "gid://shopify/MenuItem/307741084",
                "title": "Sofa",
                "url": "/collections/sofa",
                "resourceId": "gid://shopify/Collection/307741084",
                "type": "COLLECTION",
                "items": [
  
                ]
              },
              {
                "id": "gid://shopify/MenuItem/375350346",
                "title": "Sound System",
                "url": "/collections/sound-system",
                "resourceId": "gid://shopify/Collection/375350346",
                "type": "COLLECTION",
                "items": [
  
                ]
              },
              {
                "id": "gid://shopify/MenuItem/837241978",
                "title": "Massage Chairs",
                "url": "/collections/massage%20chairs",
                "resourceId": "gid://shopify/Collection/837241978",
                "type": "COLLECTION",
                "items": [
  
                ]
              },
              {
                "id": "gid://shopify/MenuItem/960081962",
                "title": "Living Room Rugs",
                "url": "/collections/living%20room%20rugs",
                "resourceId": "gid://shopify/Collection/960081962",
                "type": "COLLECTION",
                "items": [
  
                ]
              }
            ]
          },
          {
            "id": "gid://shopify/MenuItem/715378231",
            "title": "Kitchen",
            "url": "/collections/kitchen",
            "resourceId": "gid://shopify/Collection/715378231",
            "type": "COLLECTION",
            "items": [
              {
                "id": "gid://shopify/MenuItem/108641250",
                "title": "Chairs",
                "url": "/collections/chairs",
                "resourceId": "gid://shopify/Collection/108641250",
                "type": "COLLECTION",
                "items": [
  
                ]
              },
              {
                "id": "gid://shopify/MenuItem/71762467",
                "title": "Tables",
                "url": "/collections/tables",
                "resourceId": "gid://shopify/Collection/71762467",
                "type": "COLLECTION",
                "items": [
  
                ]
              },
              {
                "id": "gid://shopify/MenuItem/826396515",
                "title": "Kitchen Rugs",
                "url": "/collections/kitchen%20rugs",
                "resourceId": "gid://shopify/Collection/826396515",
                "type": "COLLECTION",
                "items": [
  
                ]
              }
            ]
          }
        ]
      },
      {
        "id": "gid://shopify/MenuItem/698896745",
        "title": "Mega Sofa Sale",
        "url": "/collections/mega%20sale",
        "resourceId": "gid://shopify/Collection/307741084",
        "type": "COLLECTION",
        "items": [
  
        ]
      }
    ]
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) {
    menuUpdate(id: $id, title: $title, handle: $handle, items: $items) {
      menu {
        id
        handle
        items {
          id
          title
          items {
            id
            title
          }
        }
      }
    }
  }`,
  {
    variables: {
      "id": "gid://shopify/Menu/442047006",
      "title": "updated menu",
      "handle": "danielstuff-main-menu",
      "items": [
        {
          "id": "gid://shopify/MenuItem/398712010",
          "title": "Electronics",
          "url": "collection/tables",
          "resourceId": "gid://shopify/Collection/71762467",
          "type": "COLLECTION",
          "items": [
    
          ]
        },
        {
          "id": "gid://shopify/MenuItem/643685044",
          "title": "Furniture",
          "url": "/collections/furniture",
          "resourceId": "gid://shopify/Collection/643685044",
          "type": "COLLECTION",
          "items": [
            {
              "id": "gid://shopify/MenuItem/927352226",
              "title": "Updated Living Room",
              "url": "/collections/living-room",
              "resourceId": "gid://shopify/Collection/927352226",
              "type": "COLLECTION",
              "items": [
                {
                  "id": "gid://shopify/MenuItem/307741084",
                  "title": "Sofa",
                  "url": "/collections/sofa",
                  "resourceId": "gid://shopify/Collection/307741084",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/375350346",
                  "title": "Sound System",
                  "url": "/collections/sound-system",
                  "resourceId": "gid://shopify/Collection/375350346",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/837241978",
                  "title": "Massage Chairs",
                  "url": "/collections/massage%20chairs",
                  "resourceId": "gid://shopify/Collection/837241978",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/960081962",
                  "title": "Living Room Rugs",
                  "url": "/collections/living%20room%20rugs",
                  "resourceId": "gid://shopify/Collection/960081962",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                }
              ]
            },
            {
              "id": "gid://shopify/MenuItem/715378231",
              "title": "Kitchen",
              "url": "/collections/kitchen",
              "resourceId": "gid://shopify/Collection/715378231",
              "type": "COLLECTION",
              "items": [
                {
                  "id": "gid://shopify/MenuItem/108641250",
                  "title": "Chairs",
                  "url": "/collections/chairs",
                  "resourceId": "gid://shopify/Collection/108641250",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/71762467",
                  "title": "Tables",
                  "url": "/collections/tables",
                  "resourceId": "gid://shopify/Collection/71762467",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/826396515",
                  "title": "Kitchen Rugs",
                  "url": "/collections/kitchen%20rugs",
                  "resourceId": "gid://shopify/Collection/826396515",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                }
              ]
            }
          ]
        },
        {
          "id": "gid://shopify/MenuItem/698896745",
          "title": "Mega Sofa Sale",
          "url": "/collections/mega%20sale",
          "resourceId": "gid://shopify/Collection/307741084",
          "type": "COLLECTION",
          "items": [
    
          ]
        }
      ]
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) {
    menuUpdate(id: $id, title: $title, handle: $handle, items: $items) {
      menu {
        id
        handle
        items {
          id
          title
          items {
            id
            title
          }
        }
      }
    }
  }
QUERY

variables = {
  "id": "gid://shopify/Menu/442047006",
  "title": "updated menu",
  "handle": "danielstuff-main-menu",
  "items": [{"id"=>"gid://shopify/MenuItem/398712010", "title"=>"Electronics", "url"=>"collection/tables", "resourceId"=>"gid://shopify/Collection/71762467", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/643685044", "title"=>"Furniture", "url"=>"/collections/furniture", "resourceId"=>"gid://shopify/Collection/643685044", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/927352226", "title"=>"Updated Living Room", "url"=>"/collections/living-room", "resourceId"=>"gid://shopify/Collection/927352226", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/307741084", "title"=>"Sofa", "url"=>"/collections/sofa", "resourceId"=>"gid://shopify/Collection/307741084", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/375350346", "title"=>"Sound System", "url"=>"/collections/sound-system", "resourceId"=>"gid://shopify/Collection/375350346", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/837241978", "title"=>"Massage Chairs", "url"=>"/collections/massage%20chairs", "resourceId"=>"gid://shopify/Collection/837241978", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/960081962", "title"=>"Living Room Rugs", "url"=>"/collections/living%20room%20rugs", "resourceId"=>"gid://shopify/Collection/960081962", "type"=>"COLLECTION", "items"=>[]}]}, {"id"=>"gid://shopify/MenuItem/715378231", "title"=>"Kitchen", "url"=>"/collections/kitchen", "resourceId"=>"gid://shopify/Collection/715378231", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/108641250", "title"=>"Chairs", "url"=>"/collections/chairs", "resourceId"=>"gid://shopify/Collection/108641250", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/71762467", "title"=>"Tables", "url"=>"/collections/tables", "resourceId"=>"gid://shopify/Collection/71762467", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/826396515", "title"=>"Kitchen Rugs", "url"=>"/collections/kitchen%20rugs", "resourceId"=>"gid://shopify/Collection/826396515", "type"=>"COLLECTION", "items"=>[]}]}]}, {"id"=>"gid://shopify/MenuItem/698896745", "title"=>"Mega Sofa Sale", "url"=>"/collections/mega%20sale", "resourceId"=>"gid://shopify/Collection/307741084", "type"=>"COLLECTION", "items"=>[]}]
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) {
      menuUpdate(id: $id, title: $title, handle: $handle, items: $items) {
        menu {
          id
          handle
          items {
            id
            title
            items {
              id
              title
            }
          }
        }
      }
    }`,
    "variables": {
      "id": "gid://shopify/Menu/442047006",
      "title": "updated menu",
      "handle": "danielstuff-main-menu",
      "items": [
        {
          "id": "gid://shopify/MenuItem/398712010",
          "title": "Electronics",
          "url": "collection/tables",
          "resourceId": "gid://shopify/Collection/71762467",
          "type": "COLLECTION",
          "items": [
    
          ]
        },
        {
          "id": "gid://shopify/MenuItem/643685044",
          "title": "Furniture",
          "url": "/collections/furniture",
          "resourceId": "gid://shopify/Collection/643685044",
          "type": "COLLECTION",
          "items": [
            {
              "id": "gid://shopify/MenuItem/927352226",
              "title": "Updated Living Room",
              "url": "/collections/living-room",
              "resourceId": "gid://shopify/Collection/927352226",
              "type": "COLLECTION",
              "items": [
                {
                  "id": "gid://shopify/MenuItem/307741084",
                  "title": "Sofa",
                  "url": "/collections/sofa",
                  "resourceId": "gid://shopify/Collection/307741084",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/375350346",
                  "title": "Sound System",
                  "url": "/collections/sound-system",
                  "resourceId": "gid://shopify/Collection/375350346",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/837241978",
                  "title": "Massage Chairs",
                  "url": "/collections/massage%20chairs",
                  "resourceId": "gid://shopify/Collection/837241978",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/960081962",
                  "title": "Living Room Rugs",
                  "url": "/collections/living%20room%20rugs",
                  "resourceId": "gid://shopify/Collection/960081962",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                }
              ]
            },
            {
              "id": "gid://shopify/MenuItem/715378231",
              "title": "Kitchen",
              "url": "/collections/kitchen",
              "resourceId": "gid://shopify/Collection/715378231",
              "type": "COLLECTION",
              "items": [
                {
                  "id": "gid://shopify/MenuItem/108641250",
                  "title": "Chairs",
                  "url": "/collections/chairs",
                  "resourceId": "gid://shopify/Collection/108641250",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/71762467",
                  "title": "Tables",
                  "url": "/collections/tables",
                  "resourceId": "gid://shopify/Collection/71762467",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                },
                {
                  "id": "gid://shopify/MenuItem/826396515",
                  "title": "Kitchen Rugs",
                  "url": "/collections/kitchen%20rugs",
                  "resourceId": "gid://shopify/Collection/826396515",
                  "type": "COLLECTION",
                  "items": [
    
                  ]
                }
              ]
            }
          ]
        },
        {
          "id": "gid://shopify/MenuItem/698896745",
          "title": "Mega Sofa Sale",
          "url": "/collections/mega%20sale",
          "resourceId": "gid://shopify/Collection/307741084",
          "type": "COLLECTION",
          "items": [
    
          ]
        }
      ]
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation UpdateMenu($id: ID!, $title: String!, $handle: String!, $items: [MenuItemUpdateInput!]!) {
    menuUpdate(id: $id, title: $title, handle: $handle, items: $items) {
      menu {
        id
        handle
        items {
          id
          title
          items {
            id
            title
          }
        }
      }
    }
  }
QUERY;

$variables = [
  "id" => "gid://shopify/Menu/442047006",
  "title" => "updated menu",
  "handle" => "danielstuff-main-menu",
  "items" => [{"id"=>"gid://shopify/MenuItem/398712010", "title"=>"Electronics", "url"=>"collection/tables", "resourceId"=>"gid://shopify/Collection/71762467", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/643685044", "title"=>"Furniture", "url"=>"/collections/furniture", "resourceId"=>"gid://shopify/Collection/643685044", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/927352226", "title"=>"Updated Living Room", "url"=>"/collections/living-room", "resourceId"=>"gid://shopify/Collection/927352226", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/307741084", "title"=>"Sofa", "url"=>"/collections/sofa", "resourceId"=>"gid://shopify/Collection/307741084", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/375350346", "title"=>"Sound System", "url"=>"/collections/sound-system", "resourceId"=>"gid://shopify/Collection/375350346", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/837241978", "title"=>"Massage Chairs", "url"=>"/collections/massage%20chairs", "resourceId"=>"gid://shopify/Collection/837241978", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/960081962", "title"=>"Living Room Rugs", "url"=>"/collections/living%20room%20rugs", "resourceId"=>"gid://shopify/Collection/960081962", "type"=>"COLLECTION", "items"=>[]}]}, {"id"=>"gid://shopify/MenuItem/715378231", "title"=>"Kitchen", "url"=>"/collections/kitchen", "resourceId"=>"gid://shopify/Collection/715378231", "type"=>"COLLECTION", "items"=>[{"id"=>"gid://shopify/MenuItem/108641250", "title"=>"Chairs", "url"=>"/collections/chairs", "resourceId"=>"gid://shopify/Collection/108641250", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/71762467", "title"=>"Tables", "url"=>"/collections/tables", "resourceId"=>"gid://shopify/Collection/71762467", "type"=>"COLLECTION", "items"=>[]}, {"id"=>"gid://shopify/MenuItem/826396515", "title"=>"Kitchen Rugs", "url"=>"/collections/kitchen%20rugs", "resourceId"=>"gid://shopify/Collection/826396515", "type"=>"COLLECTION", "items"=>[]}]}]}, {"id"=>"gid://shopify/MenuItem/698896745", "title"=>"Mega Sofa Sale", "url"=>"/collections/mega%20sale", "resourceId"=>"gid://shopify/Collection/307741084", "type"=>"COLLECTION", "items"=>[]}],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "id": "gid://shopify/Menu/442047006",
  "title": "updated menu",
  "handle": "danielstuff-main-menu",
  "items": [
    {
      "id": "gid://shopify/MenuItem/398712010",
      "title": "Electronics",
      "url": "collection/tables",
      "resourceId": "gid://shopify/Collection/71762467",
      "type": "COLLECTION",
      "items": []
    },
    {
      "id": "gid://shopify/MenuItem/643685044",
      "title": "Furniture",
      "url": "/collections/furniture",
      "resourceId": "gid://shopify/Collection/643685044",
      "type": "COLLECTION",
      "items": [
        {
          "id": "gid://shopify/MenuItem/927352226",
          "title": "Updated Living Room",
          "url": "/collections/living-room",
          "resourceId": "gid://shopify/Collection/927352226",
          "type": "COLLECTION",
          "items": [
            {
              "id": "gid://shopify/MenuItem/307741084",
              "title": "Sofa",
              "url": "/collections/sofa",
              "resourceId": "gid://shopify/Collection/307741084",
              "type": "COLLECTION",
              "items": []
            },
            {
              "id": "gid://shopify/MenuItem/375350346",
              "title": "Sound System",
              "url": "/collections/sound-system",
              "resourceId": "gid://shopify/Collection/375350346",
              "type": "COLLECTION",
              "items": []
            },
            {
              "id": "gid://shopify/MenuItem/837241978",
              "title": "Massage Chairs",
              "url": "/collections/massage%20chairs",
              "resourceId": "gid://shopify/Collection/837241978",
              "type": "COLLECTION",
              "items": []
            },
            {
              "id": "gid://shopify/MenuItem/960081962",
              "title": "Living Room Rugs",
              "url": "/collections/living%20room%20rugs",
              "resourceId": "gid://shopify/Collection/960081962",
              "type": "COLLECTION",
              "items": []
            }
          ]
        },
        {
          "id": "gid://shopify/MenuItem/715378231",
          "title": "Kitchen",
          "url": "/collections/kitchen",
          "resourceId": "gid://shopify/Collection/715378231",
          "type": "COLLECTION",
          "items": [
            {
              "id": "gid://shopify/MenuItem/108641250",
              "title": "Chairs",
              "url": "/collections/chairs",
              "resourceId": "gid://shopify/Collection/108641250",
              "type": "COLLECTION",
              "items": []
            },
            {
              "id": "gid://shopify/MenuItem/71762467",
              "title": "Tables",
              "url": "/collections/tables",
              "resourceId": "gid://shopify/Collection/71762467",
              "type": "COLLECTION",
              "items": []
            },
            {
              "id": "gid://shopify/MenuItem/826396515",
              "title": "Kitchen Rugs",
              "url": "/collections/kitchen%20rugs",
              "resourceId": "gid://shopify/Collection/826396515",
              "type": "COLLECTION",
              "items": []
            }
          ]
        }
      ]
    },
    {
      "id": "gid://shopify/MenuItem/698896745",
      "title": "Mega Sofa Sale",
      "url": "/collections/mega%20sale",
      "resourceId": "gid://shopify/Collection/307741084",
      "type": "COLLECTION",
      "items": []
    }
  ]
}
Hide code
Response
JSON
{
  "menuUpdate": {
    "menu": {
      "id": "gid://shopify/Menu/442047006",
      "handle": "danielstuff-main-menu",
      "items": [
        {
          "id": "gid://shopify/MenuItem/398712010",
          "title": "Electronics",
          "items": []
        },
        {
          "id": "gid://shopify/MenuItem/643685044",
          "title": "Furniture",
          "items": [
            {
              "id": "gid://shopify/MenuItem/927352226",
              "title": "Updated Living Room"
            },
            {
              "id": "gid://shopify/MenuItem/715378231",
              "title": "Kitchen"
            }
          ]
        },
        {
          "id": "gid://shopify/MenuItem/698896745",
          "title": "Mega Sofa Sale",
          "items": []
        }
      ]
    }
  }
}