---
title: >-
  Identify cart lines by view_key in cartLinesUpdate and cartLinesRemove -
  Shopify developer changelog
description: >-
  Shopify’s developer changelog documents all changes to Shopify’s platform.
  Find the latest news and learn about new platform opportunities.
source_url:
  html: 'https://shopify.dev/changelog/posts/cart-line-mutations-accept-view-key'
  md: 'https://shopify.dev/changelog/posts/cart-line-mutations-accept-view-key.md'
metadata:
  effectiveApiVersion: 2026-07
  affectedApi:
    - displayName: Storefront API
      handle: storefront-graphql
  primaryTag:
    displayName: API
    handle: api
  secondaryTag:
    displayName: New
    handle: new
  indicatesActionRequired: false
  createdAt: '2026-05-29T11:30:32-04:00'
  postedAt: '2026-06-02T12:00:00-04:00'
  updatedAt: '2026-06-03T10:14:36-04:00'
  effectiveAt: '2026-06-02T12:00:00-04:00'
---

June 2, 2026

# Identify cart lines by `view_key` in `cartLinesUpdate` and `cartLinesRemove`

DateJune 2, 2026

Version[2026-07](https://shopify.dev/changelog?api_version=2026-07)

FlagsNew

SurfacesAPI

Affected APIs[Storefront API](https://shopify.dev/changelog?api_type=storefront-graphql)

You can now identify cart lines by their `view_key` when calling the [`cartLinesUpdate`](https://shopify.dev/docs/api/storefront/2026-07/mutations/cartLinesUpdate) and [`cartLinesRemove`](https://shopify.dev/docs/api/storefront/2026-07/mutations/cartLinesRemove) mutations, as an alternative to the cart line `id`.

## What's new

* `cartLinesUpdate` accepts a `viewKey` on each `CartLineUpdateInput`, mutually exclusive with `id`.
* `cartLinesRemove` accepts a `viewKeys` list, mutually exclusive with `lineIds`.

## How to use

Provide exactly one identifier per line. Existing integrations that use `id` or `lineIds` keep working with no changes.

```graphql
mutation RemoveLineByViewKey($cartId: ID!) {
    cartLinesRemove(cartId: $cartId, viewKeys: ["794864053:7c2a9f..."]) {
      cart { id }
      userErrors { field message }
    }
  }
```
