Finding and exporting Shopify variant IDs
There may be instances where you need to find and export your variant IDs in Shopify. For example, when filling out a migration document or when completing a bulk update to modify your products. This guide will highlight how to find the variant IDs for your products in Shopify.
- 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
- Shopify limits the number of variants displayed so if you have several products and variants you'll need to use Postman or another program to delay the API calls. Or loop through each page to get all the variants.
- It is recommended to add the JSON View Extension if using Chrome. This will display the JSON data in Shopify in a readable format.
- If you do not feel comfortable working with JSON, you can try using an app like Product & Variant IDs from the Shopify App Store.
Use the JSON URL in Shopify to find variant IDs
Step 1 - Create the JSON URL
When logged into your Shopify admin, add variants.json
to the end of the URL. It should look like this:
https://admin.shopify.com/store/my-test-store/variants.json
Once the URL is loaded, you should see variant data populated in JSON format on the next screen.
Step 2 - Modify the JSON URL for more options
You can modify it by adding ?fields=id,product-id,title
to show you only the variant ID, product ID, and variant title:
https://admin.shopify.com/store/my-test-store/variants.json?fields=id,product-id,title
You can modify it further by adding &limit=49
to make sure the view presents all products in your catalog:
https://admin.shopify.com/store/my-test-store/variants.json?fields=id,product-id,title&limit=49
If you have more than 49 variants, you will need to append page designations such as &page=2
until all products are accounted for in the JSON view. This is based on Shopify's API limit.
Step 3 - Copy and export the JSON data
Once all variant information is in view, you can copy and paste the JSON data into a free online JSON to CSV converter tool such as JSON to CSV Converter. This will aggregate the data and provide a CSV file with the information organized in columns. You'll need to get the product titles separately and map them to the correct row in the CSV file using the product ID column.
Find the variant ID using the cart.js
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.