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.
Removing all the variants from a list of products is simple, if not completely obvious:
- Download a CSV as a starting point, removing any products that you don’t want to include.
- Remove all the variant records, these are the rows with a blank Title (among other fields).
- Set Option1 Name to “Title” (without the quotes).
- Set Option1 Value to “Default” (without the quotes).
- Remove option 2 and option 3 fields or make them blank.
- I tend to remove a load of optional fields since they just get in the way.
- Remember to save your CSV with double quotes for escaping text.
- Import your file! Check the overwrite option otherwise the update will be ignored.
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!
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.
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!