In some cases, you may need to export the Shopify Variant IDs for your products - 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
Before you begin
- 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
Start by adding
/admin/variants in your Address Bar following your Shopify URL when logged into your Shopify Dashboard. It should look like this:
.json to the end of the URL following variants:
Once the URL is loaded, you should see variant data populated in JSON format on the next screen.
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:
You can modify it further by adding
&limit=250 to make sure the view presents all products in your catalog:
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.
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.
Alternate method - 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: http://www.website.com/cart.js
.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.
Didn’t find what you’re looking for?Contact us