Find a variant ID
Variant IDs are sometimes needed to make theme code customizations that target specific product variants. If you need to find a variant ID, you can do so from within your Shopify admin.
From your Shopify admin, go to Products > All products.
Click on a product.
Once you are viewing a product, look at your browser's URL bar. You should see a URL similar to this:
At the end of the URL, add
Using the example URL above, the result looks like this:
Press the Enter key, so that your browser redirects to a new page.
You will see an XML file that contains all of the variant information for that product. The information for all of the variants is found within an opening
<variants type="array">tag, and a closing
</variants>tag. Inside the
<variants>element, the information for each unique variant is nested in its own
<variant>element. You'll see that each
<variant>element contains other elements, such as
<price>, and so on.
Look for the for the
<title>tag inside a
<variant>element. In this case, the title is a summary of the product options that make up the variant, with the options separated by
/s. For example, if you want to find the ID for a variant with options for Color, Fabric, and Size, and the values for these options are Blue, Cotton, and Small, then the XML code will look like this:
Once you find the
<title>for the variant, look for an
<id>tag within the same
<id>tag is two lines above the
<title>tag, and looks similar to this:
The number found within the
<id>element is the variant ID. In the above example, the variant ID is