Variants and Shopify CSV imports

I had one of those really annoying tasks to do the other day and it reminded me how there are no clear instructions on how to do a couple things. I needed to remove all variants from a large set of products and then add a whole load of new, different ones. There are a couple of gotchas to both deleting variants by CSV as well as to adding variants by CSV import, so I thought I would lay out the process.

Deleting Variants

Removing all the variants from a list of products is simple, if not completely obvious:

  1. Download a CSV as a starting point, removing any products that you don’t want to include.
  2. Remove all the variant records, these are the rows with a blank Title (among other fields).
  3. Set Option1 Name to “Title” (without the quotes).
  4. Set Option1 Value to “Default” (without the quotes).
  5. Remove option 2 and option 3 fields or make them blank.
  6. I tend to remove a load of optional fields since they just get in the way.
  7. Remember to save your CSV with double quotes for escaping text.
  8. Import your file! Check the overwrite option otherwise the update will be ignored.

Adding Variants

Upload a single row for a product with a new variant value will overwrite the main item if the overwrite option is checked. If it is not checked then the update will be ignored. You cant import variant records on their own!

This will not work

Instead you need to include all variants at the same time, which is a bit of a pain but not the end of the world as you can download a CSV with existing variants included. The first row with the title (highlighted below in green) is used as the main product record and has the full set of fields. The rows underneath each of these (highlighted below in blue) without title text, are the variants and omit many fields, the key fields are the handle, options, price and weight.

Structure of an import CSV with variants (not all fields shown)

As you can see above, the Steel Widget has one main record with a SKU of 10000 and four other variant records, one for each of the sizes. The Copper Widget has variants based on two attributes; Size and Finish.

As you can see from above there are some fields that are filled in for the variant records (for example Variant Inventory Policy ) I tend to fill these with the same text as I see from an export as I haven’t worked out which are surplus to requirements.

Happy variant manipulating!

Leave a Reply

Your email address will not be published. Required fields are marked *