Storefront MCP tool update_cart failure

I have followed the guide here

but this tool doesn’t seem to be working. It only creates the cart with empty line items

{
  jsonrpc: '2.0',
  method: 'tools/call',
  id: 1,
  params: {
    name: 'update_cart',
    arguments: {
      lines: [
        {
          merchandise_id: `gid://shopify/ProductVariant/...`,
          quantity: 1
        }
      ]
    }
  }
}
{
  id: 'gid://shopify/Cart/...?key=...',
  created_at: '2025-07-21T10:34:21.153Z',
  updated_at: '2025-07-21T10:34:21.153Z',
  lines: [],
  delivery: {},
  discounts: {},
  gift_cards: [],
  cost: {
    total_amount: { amount: '0.0', currency: 'VND' },
    subtotal_amount: { amount: '0.0', currency: 'VND' }
  },
  total_quantity: 0,
  checkout_url: '...'
}

Also it doesn’t throw any errors, even when I omit field lines or merchandise_id
I have tried using storefront API cartLinesAdd with the same parameters for the same cart and it works. I can get the updated cart with get_cart tool from MCP

Hi @datvm23

Thanks for flagging this behaviour - digging into this on my side now.

Hi again @datvm23

We were unable to replicate this on our side - and it’s working when we try it out on a test store. Can you share a request ID (from the response headers) on their MCP update_cart tool request for us to dig deeper? It’s possible this is a product publication issue - where the product is not published on the correct channel.

Hi @Liam-Shopify,

I am following this as well because I am running into the same issue as datvm23. Could you please confirm what would be the correct product setup and if possible an example of your working test API request? I’ve tried this on two separate stores with live products published on Sales channels and both created non-working carts with empty line items.

Hey @Joel_Chan

Do you have a requestID that we could use to see what might be going on here?

Hi @Liam-Shopify,

Please see below for an example output from a request I made that created an empty cart using an active variant id with inventory in stock:

"{"instructions":"Ask if the customer has found everything they need. If they’re ready to check out:\n\n1. First help them complete their cart with any additional items they might need\n2. If the cart contains shipping-eligible items, prompt them to select a shipping option from those available\n3. Ask if they’d like to add any special instructions or notes to their order (optional)\n4. Check if they have any discount codes or gift cards they’d like to apply (only if they mention them)\n5. Assist them in navigating to checkout by providing a markdown link to the checkout URL\n\nRemember that buyer information helps calculate accurate shipping rates but isn’t required to proceed.\n","cart":{"id":"gid://shopify/Cart/hWN1EEk1TMciQKMuutTnlN3q?key=faa70f279269615ca748a482c6061f44","created_at":"2025-07-30T17:34:33.632Z","updated_at":"2025-07-30T17:34:33.632Z","lines":,"delivery":{},"discounts":{},"gift_cards":,"cost":{"total_amount":{"amount":"0.0","currency":"CAD"},"subtotal_amount":{"amount":"0.0","currency":"CAD"}},"total_quantity":0,"checkout_url":"ada-indigo-demo-store

It would be helpful to see an example from the Shopify side of a working test API request.

1 Like

Thanks for sharing this Joel - digging into this more on my side.

Still unable to see what might be happening here - are you still seeing this issue?

Hi I’ve the same problem. Same payload and no products in the cart. It’s always empty. The variant is available and in stock. As endpoint i use www.domainname.com/api/mcp as described here: Storefront MCP server

To Replicate the issue you can use the below code

import json

# Basic setup for Storefront MCP server requests
store_domain = "shopchatmcp.myshopify.com"  # 🔸 Replace with your store domain
mcp_endpoint = f"https://{store_domain}/api/mcp"

# Prepare the JSON-RPC payload for updating cart
payload = {
    "jsonrpc": "2.0",
    "method": "tools/call",
    "id": 1,
    "params": {
        "name": "update_cart",
        "arguments": {
            # "cart_id": "gid://shopify/Cart/abc123def456",   # existing cart ID (optional)
            "lines": [
                {
                    # "line_item_id": "gid://shopify/CartLine/line2",  # optional if adding new item
                    "merchandise_id": "gid://shopify/ProductVariant/47284154400920",
                    "quantity": 2
                }
            ]
        }
    }
}

# Set headers
headers = {
    "Content-Type": "application/json"
}

# Send POST request to MCP endpoint
response = requests.post(mcp_endpoint, headers=headers, data=json.dumps(payload))

# Handle response
if response.status_code == 200:
    data = response.json()
    print("✅ Cart update successful!")
    print(json.dumps(data, indent=4, ensure_ascii=False))

    # Optional: save response to file
    with open("update_cart_response.json", "w", encoding="utf-8") as f:
        json.dump(data, f, indent=4, ensure_ascii=False)
    print("💾 Response saved to 'update_cart_response.json'")

else:
    print(f"❌ Request failed with status {response.status_code}")
    print(response.text)

Hey everyone, Vedant posted in a separate thread and I was able to identify the issue. See if the solution I provided here will work for you as well: