Case study 3: Importing a product with options and variations
You can import new products with options and variations, or you can import options and variations for products that already exist in your store.
In this section, you’ll learn how to import a new product with both options and variations into your store.
In our example, we’ll use the same sample product:
A black dress from this season’s collection that costs $25, weighs 1 lb, and already has an SKU (A0001).
Let’s say it has three “Size” options (with values “S”, “M”, and “L”) and two “Color” options (with values “Total black” and “Black with floral pattern”). All the options cost the same, and you want to display them as radio buttons on the product page without preselecting a certain option.
Based on these options, the product has six variations. All the “Total black” ones cost $25, and all the “Black with floral pattern” ones cost $30. Each product variation has its own SKU.
To create an import file:
- Open your spreadsheet editor.
- Enter “type” in the first cell. Then enter “product” in the row below it, and fill out all the other columns for the product itself (See Case study 1).
- In the following rows, add data on “Size” and “Color” product option values (see Case study 2 for the algorithm).
- In the next row, enter “product_variation” in the “type” column:
Now you’ve specified that this row is about a product variation.
- In the “product_sku” column, enter “A0001” again. That’s the SKU of the product this variation belongs to. By specifying it, you let the import tool know which product in your store this variation goes to.
- Add the “product_variation_option_Size” column to the file header and enter “S” as its value for the “product_variation” row:
Now you’ve specified that the variation in this row is formed based on the size “S” option.
- Then add the “product_variation_option_Color” column to the file header and enter “Total black” as its value for the same “product_variation” row.
Now you’ve specified that the variation in this row is also formed based on the “Total black” color option.
- So, by now, you’ve specified that this row is about a size “S” + “Total black” color variation.
Now you can enter its price ($25) into the “product_price” column for the “product_variation” row. Yes, you can use the same “product_price” column both for your products and for their variations!
- Next, add the “product_variation_sku” column to the file header and enter “A00011” (or any other SKU you like) as its value for the “product variation” row.
This way, you set the SKU for this particular product variation.
- Congrats! You have entered all the data you need for the size “S” + “Total black” color variation.
Now add a new “product_variation” row and repeat the process for the size “M” + “Total black” color variation. Then for then size “L” + “Total black” color variation, size “S” + “Black with floral pattern” color, etc., until you have all the variations covered.In the end, every product variation must have its own row.
- Now save/download the file as .csv to your device. In Google Sheets, you can do it by going to File → Download → Comma Separated Values (.csv).
That’s it! You’ve compiled a file for the “Black Dress” product with three size options, two color options, and six variations that are based on them. You can find the “product_with_options_and_variations” file in the article attachments.
After you upload this file on the Catalog → Data Import & Export page, the product will be added to your store. Here’s how options and variations will look on the Options tab in your store admin:
As you can see, this new product will have all the product options and variations from the initial list.
Now you can choose any product with options and variations from your catalog and follow these instructions step by step to compile your own import file. If you need to add several different product options and variations to a product or several products with product options and variations, simply add rows with data on them to the same file.
If later you need to update options and variations for your product, we recommend creating and uploading a new file that will contain all the option and variation data that you need your product(s) to have after import. However, if you want to update existing product variations and don’t need to make changes to existing product options, you can include only the rows with the variation data in your file (and exclude the rows with data on options).