---
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/cart-line-mutations-accept-view-key'
  md: 'https://shopify.dev/changelog/cart-line-mutations-accept-view-key.md'
metadata:
  effectiveApiVersion: 2026-07
  affectedApi:
    - displayName: Storefront GraphQL 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-02T09:41:14-04:00'
  effectiveAt: '2026-06-02T12:00:00-04:00'
---

June 2, 2026

Tags:

* Storefront GraphQL API
* 2026-07

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

You can now identify cart lines by their `view_key` when calling the [`cartLinesUpdate`](https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate) and [`cartLinesRemove`](https://shopify.dev/docs/api/storefront/latest/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 }
    }
  }
```
