Case study 5: Importing store categories
You can import both new root categories and subcategories, and you can also update the categories that already exist in your store.
In this section, you’ll learn how to import new categories into your store.
Let’s say you want to import two categories:
- A new root category “New arrivals” that must be enabled and has a “This season's newest arrivals” description. This category also has an image.
- A new subcategory “Dresses” that is added to a root “Women’s apparel” category. You want the "Dresses" category to be disabled and have no image.
To create an import file:
- Open your spreadsheet editor.
- Enter “type” in the first cell. Then enter “category” in the row below it:
Now you’ve specified that the second row is about a store category (and not a product or a product file). - In the next column, enter “category_path” and the path to the first category – “New arrivals” – as its value for the “category” row:
It’s a root category, so the path to it in your store corresponds to its name. - Then add the “category_is_available” column to the file header and “TRUE” as its value for the “category” row:
This way, you specify that this category is enabled. - Next, similarly, add “category_description” and enter “This season's newest arrivals”.
- Then add the “category_image” column to the file header and enter the link to this image on the web (in our example, it’s https://d2j6dbq0eux0bg.cloudfront.net/images/37497010/2950331322.jpg).
- Congrats! You have entered all the data you need for the “New arrivals” category.
Now add a new “category” row. It will be dedicated to the “Dresses” subcategory:
- In the “category_path” column, enter the path to this subcategory – “Women’s apparel/Dresses”. This way, you specify that the “Dresses” category is placed inside the root “Women’s apparel” category.
If categories/subcategories from the subcategory path do not exist in your store, they will be created automatically after import. If they already exist, the subcategory will simply be added into them.
- In the “category_is_available” column, enter “FALSE”. This way, you specify that this subcategory must be disabled.
- 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 an import file for two store categories: “New arrivals” and “Dresses” (you can find the “store_categories” file in the article attachments):
After you upload this file on the Catalog → Data Import & Export page, categories will be added to your store. Here’s how they will look on the Catalog → Categories page in your store admin:
Now you can choose any categories from your catalog and follow these instructions step by step to compile your own CSV file.
See the list of available category columns →
If later you need to update your categories, you can do it by importing a new file with data. In this file, “category_path” and/or “category_internal_id” columns must be present along with the columns for category attributes that you want to update.