To get Shopify variant ID:
- Navigate to Products from the Shopify admin page.
- Select the Product for which you want to get Shopify variant ID.
- Once you open the product, navigate to your URL bar. The URL for the product will look something like this :
- To the URL, add .xml at the end. So, your link will look something like this:
- Follow the link, and you will be redirected to a new page that contains an XML. FInd the tag <variants type=”array”>. All the information regarding your variant can be found between <variants type=”array”>.......</variants>.
- There are various elements of the variant that are present between these tags. Find the tag <title>, this is the title is the product options summary that are elements of the variant. For example, if you are looking for the ID of a product large, woolen and green, then the code for that will look like this:
<title>Large / Woolen / Green</title>.
- Once you find the tag for the product variant you want, look for the tag <id>. The tag is two lines above the <title> tag for the product variant you want details for. The tag looks like this:
- The number found within the tags <id>.....</id> is the variant ID of the product you are searching for. In this case, the example variant ID is 999999999.
Shopify also offers a much faster solution to extract product ID. However, it is not free like the previous method. You can purchase an app from the Shopify app store, such as Product & Variant IDs. The variant IDs are immediately extracted when you use the app.