---
title: >-
  Read a cart line's viewKey from the CartLine type - 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-view-key-field'
  md: 'https://shopify.dev/changelog/cart-line-view-key-field.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-06-10T18:42:52-04:00'
  postedAt: '2026-06-12T13:00:00-04:00'
  updatedAt: '2026-06-11T19:14:33-04:00'
  effectiveAt: '2026-06-12T13:00:00-04:00'
---

June 12, 2026

Tags:

* Storefront GraphQL API
* 2026-07

# Read a cart line's `viewKey` from the `CartLine` type

The [`CartLine`](https://shopify.dev/docs/api/storefront/2026-07/objects/CartLine) type now exposes a `viewKey` field, so you can correlate a returned cart line with the `viewKey` you sent to [`cartLinesUpdate`](https://shopify.dev/docs/api/storefront/2026-07/mutations/cartLinesUpdate) and [`cartLinesRemove`](https://shopify.dev/docs/api/storefront/2026-07/mutations/cartLinesRemove).

## What's new

* `CartLine.viewKey` returns the same `viewKey` your Liquid storefront renders, alongside the existing UUID `id`.

## How to use

Previously, identifying a line by `viewKey` was input-only: you could send a `viewKey`, but the response returned a UUID `id` with no `viewKey` to map back. You can now read it directly off the line.

```graphql
query CartLines($cartId: ID!) {
  cart(id: $cartId) {
    lines(first: 10) {
      edges {
        node {
          id
          viewKey
        }
      }
    }
  }
}
```

The field reads a value the cart already stores, so existing UUID-based correlation keeps working unchanged.
