If you’re looking to import your custom field data via a CSV file, this guide will show you how. By using Custom Fields for Variations and the default import feature in WooCommerce, importing your custom fields is fairly simple.
This is particularly useful if you are setting up your custom fields on a testing site and want to import everything over to a live site.
First, we need to put the CSV file (containing your custom field data) together.
Preparing the CSV file
We need to create a CSV file with a minimum of 2 columns. The first column (A – pictured below) should be variation_id. The second column (B – pictured below) should be the Meta ID for the custom field. The Meta ID is a unique name given to your field label or name.
Note: You can add more than one custom field into this file.
To find the Meta ID for your custom field, take the following steps:
- From your WordPress dashboard, go to Products > Variation Field Groups.
- Then click to edit one of your existing field groups.
- You should then see a page called Edit Variation Field Group, hover over one of your Field Labels and click Edit.
- This should open a popup which contains all your field information. Scroll down until you see Field ID or Meta ID. The information in this section is your Meta ID. Add this line to your CSV file.
Importing the data
Once your CSV file has been created, next you’ll want to import the data into your site.
To do this, take the following steps:
- From your WordPress dashboard, go to Products > All Products and click the Import button at the top of the page.
- Then, click the Choose file button to upload your CSV file. Once uploaded, click the Continue button.
- Next you’ll need to select the ID for the variation_id column and Import as meta data for the custom fields. Then click the Run the importer button.
- That’s it, your custom fields will now be imported into your site.