Finding and exporting Shopify variant IDs
- Before you start
- Use the Recharge product page to find variant IDs
- Find all Shopify subscription variant IDs in Recharge
- Find a specific variant ID in Shopify
- Find the Shopify variant ID for a product without variants using JSON
- Find all Shopify product variant IDs using JSON
- Use the cart.js to find variant IDs
Sometimes, you may need to find and export variant IDs in Shopify. This can be useful for filling out a migration document, completing a bulk product update, or reconciling subscription product and variant information with your Shopify store.
This guide shows you how to find variant IDs for your Shopify products.
- Recharge Checkout on Shopify
- Shopify Checkout Integration
Merchants using the Recharge Checkout on BigCommerce can refer to the dedicated article for BigCommerce.
Before you start
- If you're not comfortable with JSON, you can try using apps like Product & Variant IDs or Ultimate Product ID Exporter from the Shopify App Store. You can also hire a developer to build custom reports using Shopify’s API.
- Shopify limits variant and product URL JSON calls to 50 by default, to a maximum of 250 results. For more than 250 products, consider utilizing Shopify's API to make calls with a tool like Postman, following the guidance in Shopify’s developer documentation.
- We recommend adding a JSON View Extension if using Chrome or similar extension in other browsers. This displays Shopify's JSON data in a more readable format.
Use the Recharge product page to find variant IDs
You can view the product variant ID within the Recharge merchant portal if you are using Product Subscription Plans.
- Click Products in your Recharge merchant portal and select Products from the dropdown.
- Click on the product.
- If the product only has one variant: Select Configure and then Manage variant plans to confirm the external variant ID.
- If the product has multiple variants: Click on the Variants dropdown on the product details page to confirm the external variant IDs.
Find all Shopify subscription variant IDs in Recharge
- Download the Subscription-All or Subscription-Active export under Data>Exports in your Recharge Dashboard.
- Use the
external_product_id
andexternal_variant_id
columns to highlight or remove any duplicates. - This leaves you with a list of product and variant IDs related to your subscriptions.
Find a specific variant ID in Shopify
Review Shopify's finding variant ID:
-
In your Shopify admin, click Products and select the product to be identified.
-
In the Variants section, locate the specific product variant to be identified Then click Edit.
-
The variant ID is located in your browser's address bar after /variants/:
Example URL:
https://admin.shopify.com/store/your_store_name/products/1234567/variants/36485954240671
In this example, the variant ID is 36485954240671.
Find the Shopify variant ID for a product without variants using JSON
- In your Shopify admin, click Products and select the product to be identified.
- Add .json to the end of the product URL.
- Example URL:
-
https://admin.shopify.com/store/your_store_name/products/6914008678485.json
- Review the JSON file and locate the
"id"
under"variants"
, as indicated in the screenshot below.
In this example, the variant ID is 40544990101589.
Find all Shopify product variant IDs using JSON
For advanced users
This section was created using Shopify's resources and may help you access all your variant IDs through Shopify’s product JSON URLs. Keep in mind:
- Recharge support cannot assist with this section. Direct any questions to Shopify.
- While URL pagination has been removed from Shopify, you can still use relative pagination. This allows the use of
since_id=N
(where N is the Shopifyproduct_id
) to overcome the 250 JSON product call limit. - When using since_id, products will be sorted in ascending order.
Step 1: Create the JSON URL
This method displays 250 of your products in ascending order by product_id
starting from 0.
While logged into your Shopify Admin, add the following to the end of the URL.
products.json?fields=title,variants&limit=250&since_id=0
Example URL:
https://admin.shopify.com/store/your_store_name/products.json?fields=title,variants&limit=250&since_id=0
Replace your_store_name with the URL version of your store name. Do not add .myshopify.com. (i.e. baggy-of-air.myshopify.com becomes "baggy-of-air")
Step 2: Modify the JSON URL to get the rest of your products
- Since Shopify limits JSON results to 250 products, update the URL by scrolling to the bottom of the page. Use the last listed
product_id
to replace the number (N) insince_id=N
in the URL.
Example: if the last number was 12345678. Then the new URL would become:
https://admin.shopify.com/store/your_store_name/products.json?fields=title,variants&limit=250&since_id=12345678
- Repeat as needed. You will receive the following message when no products remain.
{
"products": []
}
Step 3: Convert the JSON Data into a Table
For each returned response, use a free online tool like JSON to CSV Converter to copy and paste all of the JSON data, which will organize it into columns that you can export to a CSV file. Merge the spreadsheets as needed.
Example:
Use the cart.js to find variant IDs
Alternatively, when the product is added to the cart, you can find the variant ID by adding .js
to the end of the cart page URL.
The URL would then look like this: https://www.website.com/cart.js
When .js
is added at the end of the cart page URL it automatically opens a new window with line-item properties of the product currently in the cart. Variant ID can then be filtered out of all the line item properties present on that page.