# Find product, variant and customer IDs

> Where Shopify product, variant and customer IDs live: the admin URL, the .json trick, a variant ID report, the storefront .js URL, Liquid and the Admin API.

Page: https://lintelagency.com/resources/shopify-tricks/find-product-variant-customer-ids

## In short

A Shopify product ID is the number after /products/ in the admin URL, and a variant ID the number after /variants/ when you open a variant. For a product without variants, add .json to the product page URL and read variants > id. A custom report with the Product variant ID dimension lists them all. In themes use product.id, variant.id and customer.id; the Admin API wraps the same numbers in GIDs.

## Facts

- **Product:** admin URL …/products/<ID>
- **Variant:** …/variants/<ID> or .json
- **Bulk:** Report with Product variant ID
- **API form:** gid://shopify/ProductVariant/<ID>
- **Last checked:** 2 November 2026

## How to use it

1. Product: open it in the admin and copy the number at the end of the URL.
2. Variant: click the variant on the product page and copy the number after /variants/; for a product without variants, add .json to the URL.
3. Many variants: Analytics > Reports > New exploration, add the Product variant ID dimension, then save or export.
4. Customer: in theme code use {{ customer.id }} for the logged-in customer; in the Admin API, query customers by email and read the GID.

## Code

### customer-id.graphql

```graphql
# Admin API: find a customer's ID by email. The numeric ID is the last part of the GID.
query CustomerIdByEmail($query: String!) {
  customers(first: 1, query: $query) {
    nodes {
      id
      defaultEmailAddress {
        emailAddress
      }
    }
  }
}
```

### show-ids.liquid

```liquid
{%- comment -%}
  Prints IDs while you build theme code. Keep it in an unpublished theme or
  behind request.design_mode so customers never see it.
{%- endcomment -%}
{%- if request.design_mode -%}
  <pre>
product.id:                {{ product.id }}
selected variant id:       {{ product.selected_or_first_available_variant.id }}
all variant ids:           {{ product.variants | map: 'id' | join: ', ' }}
{%- if customer %}
customer.id (logged in):   {{ customer.id }}
{%- endif %}
  </pre>
{%- endif -%}
```

### where-to-find.txt

```text
# Product ID: the number after /products/ in the admin URL
https://admin.shopify.com/store/your-store/products/1234567890

# Variant ID: open the variant; the number after /variants/
https://admin.shopify.com/store/your-store/products/1234567890/variants/12345678901234

# Product without variants (or all variant IDs at once): add .json to the product URL
https://admin.shopify.com/store/your-store/products/1234567890.json
-> "product" > "variants" > "id"

# Many variant IDs: Analytics > Reports > New exploration
Metric: Percent of inventory sold
Dimensions: Product title, Product variant title, Product variant ID
-> Save or export

# From the storefront (no admin access needed)
https://your-store.com/products/example-product.js     -> "id" and "variants[].id"
https://your-store.com/products/example-product?variant=12345678901234

# GraphQL Admin API IDs are the same numbers inside a GID
gid://shopify/Product/1234567890
gid://shopify/ProductVariant/12345678901234
gid://shopify/Customer/9876543210
```

### customer-id.variables.json

```json
{"query": "email:\"name@example.com\""}
```

## Limits and edge cases

- A product without variants still has one variant (titled Default Title) with its own ID; cart links need that variant ID, not the product ID.
- Changing a product’s option values in a CSV import creates new variant IDs.
- The storefront /products/<handle>.js URL also lists every variant ID, without admin access.
- Shopify is rolling out a redesigned product page, so where you click to open a variant may differ.

## Questions

### How do I find a variant ID in Shopify?

Open the variant in the admin and copy the number after /variants/ in the URL, or add .json to the product page URL.

### How do I find the variant ID of a product with no variants?

Add .json to the product’s admin URL and read product > variants > id. It’s the “Default Title” variant.

### How do I get all variant IDs at once?

Create a report exploration with Product title, Product variant title and Product variant ID, then export it.

### How do I find a customer ID?

In Liquid, customer.id for the logged-in customer. Through the Admin API, query customers with email:"…" and read the ID from the GID.

## Shopify documentation

- [Find product and variant IDs](https://help.shopify.com/en/manual/products/variants/find-variant-id)
- [customers query (Admin API)](https://shopify.dev/docs/api/admin-graphql/latest/queries/customers)
- [Liquid customer object](https://shopify.dev/docs/api/liquid/objects/customer)

## Related

- [Cart permalinks: links that fill the cart](https://lintelagency.com/resources/shopify-tricks/cart-permalinks)
- [Get a variant ID from the storefront](https://lintelagency.com/resources/shopify-tricks/variant-id-from-storefront)
- [Admin deep links: product, variant, JSON and bulk editor URLs](https://lintelagency.com/resources/shopify-tricks/admin-deep-links)
- [List the customers in a segment](https://lintelagency.com/resources/graphql/customer-segment-members)

License: MIT. Free to use in your own store and in client work.
