Often, when you wish to revamp your website or make major changes that may potentially impact your store structure or product categories, it would be wise to take a backup of all your data first. For product categories and products, this can be done by simply exporting the required categories or product data. In this post, we explore how to export WooCommerce categories and thus have a backup of the same.
For this requirement, you can use a plugin known as the WooCommerce Store Exporter plugin. It has free as well as paid versions.
If you don’t wish to use a plugin, the other alternative is to write a query using the three database tables viz. wp_term_taxonomy, wp_term_relationships and wp_terms, or take a backup of these tables, as information pertaining to product categories is stored in these tables.
This free plugin by Visser Labs lets you export a wide range of elements of your WooCommerce Store. Once you install this plugin, you can access the Export option from the Plugins page or click on the Store Export option which will appear inside the WooCommerce menu on the left hand-side of your WordPress dashboard:
Clicking on any of the two links above will take you to the Export page. As you can see in the screenshot of this page below, with this free version, you can export Categories, Products, Tags and Users.
Click on Export Categories.
You will be directed to a page where you can still change your selection or leave it to the default selected option which is “Categories”. If you wish to select only a few category fields, scroll below. Else, click on Quick Export to generate a CSV file.
As mentioned before, if you want to only import certain fields of the Category, you may skip the Quick Export and instead scroll down the page, choose the required fields and click on Export Categories . This will also generate a CSV file.
This file will contain columns pertaining to every category field:
This plugin however requires you to upgrade to their paid version if you wish to import the product categories.
Though this plugin was last updated 9 months ago & hasn’t been tested with latest 3 major release of WordPress, it worked fine when I ran my tests on WooCommerce 3.6.3 & WordPress 5.1.
Exporting WooCommerce Products
Sometimes you may want to export WooCommerce products instead of just the product categories. This requirement is met by the newer versions of WooCommerce (3.x). In these versions, you can export products directly through the dashboard.
Navigate to Products->All Products in your WordPress Dashboard:
Next to the heading that says “Products”, you will find three buttons viz. Add New, Import and Export. Click on the Export button.
This is where you can export your products and categories:
You can choose to export only a few columns of the product, by selecting the required columns from the dropdown available in the first field. However, it is recommended that if you intend to take a backup, then leave this to its default value i.e. “Export all columns”. The next field takes in the product types that you wish to export, if you have a specific requirement. You can specify which categories you wish to export using the third field. The last field, which refers to “custom meta” is to be checked only if you have created any custom fields for your products. Finally, clicking on “Generate CSV” will create a CSV file of your product structure.
With the free version of this plugin, you can export as well as import products. You can access this interface through the Plugins page or by directly clicking on the “Product Im-Ex” link under Products on the left-hand side of the dashboard.
As you can see, you can also specify which fields of the product you want to export and also mention a limit to the number of products you want to export. The offset field is used to specify the number of products to be skipped before exporting. In case of this plugin too, a CSV file will be generated, which you can use to import the products again.
Exporting product categories as well as products is thus quite simple and it is also recommended that you do it every once in a while, to ensure copies of this data. This can be especially useful in multiple scenarios for e.g. moving from one web platform to another, integrating with an external system or simply before re-structuring your categories.