How to get the variant.ID for a single item product (no variants)

Topic summary

How to obtain the variant ID for a single-variant (no options) Shopify product to use in forms or add-to-cart URLs.

Key methods shared:

  • Use Liquid in theme preview: product.variants.first.id, then extract the ID (works but is a workaround).
  • Admin endpoint: /admin/variants.json lists IDs, but only 100 per page (pagination required).
  • Reports: Analytics > Reports > ABC analysis by Product; edit columns to show IDs, then export.
  • Admin product JSON: open the product in admin and append .json to the URL to view data and find the variant ID.
  • PDP URL via cart: add the product to cart, go to the cart, click the product to its page, and read the ?variant=XXXXXXXXXXXX in the URL.

Notes:

  • Even “no variants” products have a single default variant with a unique ID.
  • Some participants find these steps too technical for clients and request Shopify to surface variant IDs or provide a simple tool.

Outcome: No official solution provided; multiple workable user-found methods. Discussion remains open with a call for easier admin support.

Summarized with AI on December 24. AI used: gpt-5.

This is a bit of a dumb question…

But I need to use the variant.ID for a form but I can’t find an easy way to get the variant.ID of a product that has no variants. The easiest way I can find is using {{ product.variants.first.id }}, view the preview of the page to extract the variant.ID… there has to be a better way? (I need the variant.ID of one product to use on a different product’s page)

This is for products with no variants! So I can’t get it from the URL. I’ve tried a bit of a search on the forum and google but everything is about products with variants.

Do you know the best way?

3 Likes

Found this, it’ll probably do for now

https://youtstorename.myshopify.com/admin/variants.json

edit: oh no, it only has 100 on a page

1 Like

This looks like the best best option for now!

  1. Go to analytics > reports
  2. Under inventory click ABC analysis by Product
  3. Edit the columns to show IDs or whatever info you need
  4. Export
2 Likes

If you’re happy doing it product by product you can go to the product in the admin then type “.json” at the end of the url

12 Likes

Thanks for figuring it out! Support had no clue.

2 Likes

None of these solutions are something I can tell my clients to do. They’ll go crazy. We ALL need Shopify to either create a quick tool that generates add-to-cart urls for one or multiple products (with and without variants) or just make the only variant number part of the url in admin. I mean, this is ridiculous work to just find an id number that they chose to hide from us in the first place for no good reason.

9 Likes

To find the variant ID for a single product with no variants, follow these steps:

  1. Add the product you want to your cart: Go to the product page and add the product to your cart.
  2. Navigate to your cart: Go to your store’s cart page at https://yourstorename.myshopify.com/cart.
  3. Click on the product: In the cart, click on the product you just added. This will take you to the Product Detail Page (PDP).
  4. Check the URL: In the URL of the PDP, you will see the unique product variant ID. It will look something like this: https://yourstorename.myshopify.com/products/product-name?variant=00000000000000.
3 Likes

Thank you!