Now is your last chance to buy a lifetime license before we switch to annual pricing. Existing licenses will be unaffected.
read more
Posted on January 4, 2024

How to Import Product Categories to WooCommerce

hello world!

You have several options to import product categories to WooCommerce. If you want to import product categories as part of a product import, and that import is simple, you can use the built-in WooCommerce import tool at Tools › Import › WooCommerce Products (CSV).

However, if your product import has even the slightest complexity, or you want to import product categories on their own, you'll need an import plugin.

In this article, we perform both types of imports using WP All Import — the leading import/export plugin for WooCommerce and WordPress.

If you wish, you can follow along using this online sandbox. Choose the WooCommerce Store option and click Create Sandbox.

Table of Contents

Importing WooCommerce Product Categories Directly

Imagine that you've been sent a file containing product categories. To make this import task more interesting, let's say that the product categories are organized in a hierarchal structure like this:

Import Product Categories to WooCommerce - Sample Data

How would you import these categories into WooCommerce? Here are the steps:

Step 1: Create a New Product Category Import

Navigate to All Import › New Import in the WordPress main menu, load your import file, choose New Items as the import type, Taxonomies as the import post type, and Product Categories as the post subtype.

Import Product Categories to WooCommerce - New Import

Once you've done all this, click Continue to Step 2.

Step 2: Review the Import File

The Review Import File screen lets you check whether WP All Import has successfully parsed your import file.

Import Product Categories to WooCommerce - Review Import File

In this case, the file looks okay, so click Continue to Step 3.

Step 3: Map the Import Data to the Product Category Fields

The Drag & Drop screen will appear next. In the Name & Description section of this screen, drag the incoming termname data element from the panel on the right and drop it into the first field on the left, which is the Name field.

Import Product Categories to WooCommerce - Drag and Drop

Scroll down to the Other Category Options section and expand it. Here, drag the incoming parentname data element and drop it into the Parent Term field.

Import Product Categories to WooCommerce - Other Category Options

This mapping tells WP All Import how to relate product categories to their parent categories. Using the parentname element is only one option. With this file, we could have also used the parentid or parentslug elements.

Click Continue to Step 4.

Step 4: Configure Your Import Settings

The Import Settings screen lets you configure your import settings. First, click on Auto-detect to generate a unique identifier for each record being input. This identifier is used by WP All Import to keep track of each product category.

Import Product Categories to WooCommerce - Import Settings

The area inside the red box lets you specify what should happen if the same import is run again, i.e., whether it should create new product categories if it encounters them in the import file, update existing categories, or delete categories if they are in your WooCommerce database but are no longer present in the file.

For updates, you also have the option of choosing which fields to update.

Step 5: Complete the Product Category Import

The Confirm & Run screen should appear next. This displays a summary of your intended import:

Import Product Categories to WooCommerce - Confirm and Run

If everything looks okay, click Confirm & Run Import to start the import. Once the import finishes, the screen should update as follows:

Import Product Categories to WooCommerce - Import Complete

Ignore the message about skipped records in this example. That's because we've imported the same file multiple times.

After the import is complete, you should navigate to Products › Categories in the WordPress main menu to check that your data was imported as expected:

Import Product Categories to WooCommerce - Product Categories

And that's it — that's how you import product categories directly!

Importing WooCommerce Product Categories as Part of a Product Import

Explaining how to import WooCommerce products requires a lengthy article, so we're not going to present that information here. If you want a good overview of the topic, see How to Import WooCommerce Products from CSV and XML.

In this section, we're going to focus on the product category portion of a product import, which you manage in the Taxonomies, Categories, Tags section of the import Drag & Drop screen.

Import Product Categories to WooCommerce - Taxonomies, Categories, Tags

There are many options on this screen, so we're going to describe the ones we've used to match the simple hierarchal structure of the product categories used in the previous demonstration.

To start with, we've checked Product categories (first red rectangle) because we're importing product categories in this example.

In the second red rectangle, we've selected Products have hierarchal (parent/child) Product Categories (i.e. Sports › Golf › Clubs › Putters) because our product categories are indeed hierarchal.

In the third red rectangle, we've selected An element in my file contains the entire hierarchy (i.e., you have an element with a value = Sports › Golf › Clubs › Putters) because if you look at the productcategories data element in the right panel, you will see that our import file does indeed use this approach.

What about the other options? In some cases, the hierarchy data in your import file may be spread across multiple fields, in which case you'll have to manually identify those fields and how they relate to each other, like this:

Import Product Categories to WooCommerce - Manual Hierarchies

In other situations, you may want to map the incoming product category values to different product category values in your store:

Import Product Categories to WooCommerce - Category Value Mapping

For more information on other possibilities, please see How to Import Taxonomies, Categories, Tags.

Wrapping Up

The main point of this article is to make you aware that importing product categories to WooCommerce can be more complex than you might expect.

When this is the case, WooCommerce's built-in import tool will not be able to handle the import. Nor can simple plugins. To handle the full range of scenarios for importing WooCommerce product categories, you'll need more a advanced plugin like WP All Import. Not only can it handle every imaginable scenario with product categories, but it can also do the same for every other WordPress and WooCommerce post type.

Import Product Categories – Frequently Asked Questions

How Do I Add Product Categories in Bulk in Woocommerce?

Just follow this tutorial, as every product category import is a bulk import, whether you're importing 1 product category or 1,000. If you're importing a lot of product categories, you might want to control the import's batch processing size, which you can do in the Configure Advanced Settings section of the Import Settings screen.

How Do I Add a WooCommerce Product Category Manually?

  1. Navigate to Products › Categories in the WordPress main menu.
  2. Fill in the fields on the left-hand side of the screen.
  3. Below these fields, click the Add new category button.

How Do I Export Product Categories in WooCommerce?

You can export product categories directly by following this cheat sheet. You can export them as part of a product export by following the steps in How to Export WooCommerce Products to CSV, Excel, and XML. Pay special attention to the subsection on Product Taxonomies.

Where are Product Categories Stored in WordPress?

Product categories are stored in the wp_terms table. They can be identified as a product category (vs a tag, regular category, or some other custom taxonomy) in the wp_term_taxonomy table.

How to Import WooCommerce Products

How to Create a WooCommerce Product Import Template

A Quick Look at Importing Variable Products into WooCommerce

The 5 Best WooCommerce Product Import Plugins

Leave a Reply

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

Get Oxygen Today

Lifetime, unlimited site license

Copyright © 2024 Soflyy
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram