WP All Import

How to use WP All Import

In order to use WP All Import, you must have a csv file that contains your products.

You will usually want to transfer the fields below:

  • SKU
  • Title
  • Description
  • Price
  • Featured image
  • Category name (or categories with a parent/child relationship)
  • Attributes
  • Length, Width, Height
  • Brand name
  • Post status (publish, draft, trash)

If your products have hierarchical (parent/child) categories, then in your category csv field, you should have this format:

Sports > Golf > Clubs > Putters

For attributes, the csv column cell should have this format (let’s say that we have a size attribute):

L | XL

Testing the import

If you have a large spreadsheet and want to run a fast import do these:

  1. Go to Import Settings.
  2. Click the Configured Advanced tab.
  3. Check the Import only specified records.
  4. Insert the value 1.
  5. Save Import configuration.
  6. Run the import (as many times as you like)
  7. When you are finished with the tests, just uncheck the Import only specified records checkbox and resave the configuration.

How to use WP All Import with Google Spreadsheets

Step 1: Publish your spreadsheet to csv

To do so:

  1. Open your google spreadsheet
  2. From the menu, press File > Publish to the web
  3. At the pop-up, below link, select the table you want to add
  4. Right next to it (at the Web Page dropdown), select Comma Separated Values
  5. Press publish
  6. Copy the url

Step 2: Import to WP All Import

To do so:

  1. Go to All Import > New import.
  2. Press Download from URL, paste the CSV url from step 1.6 and press download
  3. Select Existing items and choose WooCommerce Products from the dropdown
  4. Press Continue to Step 2
  5. Add Filtering Options if you want (eg. price greater than zero).
  6. Press Continue to Step 3
  7. Drag from the right section the values you want to grab from the csv and drop them to the correct field on the left
  8. Save settings as a template
  9. Press Continue to Step 4
  10. Drag and drop the sku value to the _sku field
  11. Warning! On the Update existing posts with changed data in your file tick the Choose which data to update. Otherwise, it will erase the existing values.
  12. Click Configure Advanced Settings and in the Friendly name, give a name (eg. products).

Things to notice on step 7:

If you have a product with hierarhical categories, then at Taxonomies, Categories, Tags tab tick the Product categories, select the Products have hierarhical… option and tick the An element in my file contains the entire hierarchy (i.e. you have an element with a value = Sports > Golf > Clubs > Putters) checkbox and drag and drop the corresponding item to the categories field.

If you want to use content data, bear in mind that you cannnot keep the text formatting (eg. bold words).

Here is a list of the data you want to tick on step 11:

  • Title
  • Content
  • Attributes – Update all attributes
  • Custom Fields. Here you will find custom fields like length,width and prices. Make sure you tick it in order to synchronize the dimensions.
  • Taxonomies – Remove existing taxonomies, add new taxonomies

Here are some custom fields:

  • _price
  • _sale_price
  • _regular_price

How to protect your Google spreadsheet from errors

Protect first row from changing

In order to protect your client (the spreadsheet administrator user) from accidentally changing the first row of the spreadsheet, you should do the following:

  1. Mark the first row (the one that contains the SKU, TITLE, etc.)
  2. Go to Data > Protected Sheets and Ranges…
  3. Enter a description (eg. Protect first row)
  4. Click set permissions.
  5. Detick the users which you do not want to be able to edit this row.
  6. Click save.

Set predefined values for a cell

Some cells, may accept only a value from a list of values (eg. for the size cell, acceptable values could be S, M, L, XL).

In order to protect your client (the spreadsheet administrator user) from accidentally entering a wrong value in a cell, you can create an in-cell dropdown list, you should do the following:

  1. Select the cell or cells where you want to create a drop-down list.
  2. Click Data > Data validation.
  3. Next to “Criteria,” choose List of items and set your values like this Value 1,Value 2.
  4. If you want people to only enter items from the list, choose Reject input next to On invalid data.
  5. Click Save. The cells will show a drop-down list.

Do not allow duplicates in the SKU column

Your SKUs will be unique. In order to prevent user from enetering a duplicate sku in column A, add this validation.

  1. Select all cells from column A (except for first row)
  2. Click Data > Data Validation
  3. In Criteria, select Custom formula
  4. In the rule right next to it, add the code below
=COUNTIF($A$1:$A$10000, INDIRECT(ADDRESS(ROW(),COLUMN(),)))=1

How import users

To do so, you will have to download and activate the User Import Add-On.

How to export product images from one site to another

  • Go to the first site and in WP all export, export only sku and image url
  • Go to the second site and setup an

How to transfer your content from another site to WordPress

First, get a csv file that contains all the posts (or products) of your previous site (eg. OpenCart, Joomla, Drupal etc.). So find an appropriate plugin, install it and export the csv file.

Now, process the csv file, in order to be compatible with WP All Import.

One rule, is that each row should have a column that has unique values (eg. the SKU code of a product).

In OpenOffice, by using CTRL+F, you can use regular expressions in order to delete unwanted sections (eg. shortcodes). Make sure you click more options and tick Current selection only and Regular expressions. Here are some useful expressions.

Search for Replace with Result
\[myshortcode.*myshortcode\]  space  Remove shortcodes
[:space:]+  @@ 1st step to remove multiple spaces
@@ space 2nd step to remove multiple spaces
\.\B space Remove last dot

In MySQL, you can fix possible errors, in the product’s content text with the replace function. For example, to fix possible image url errors, you can use:

update wp_posts set post_content = replace(post_content,'http://www.mywebsite.com/image/http://www.mywebsite.com','http://www.mywebsite.com');

In order to remove non-breaking spaces you can use:

update wp_posts set post_content = replace(post_content,'&nbsp;', '<p></p>');

How to use WP All Import with WPML

If you have a multilingual store, then you probably have the WPML plugin installed. Download and install WPML All Import plugin. This is the bridge between WPML and WP All Import.

You can find more details about this plugin to the official documentation page.

Let’s say that you have eg. 2 languages, English (default) and Greek. Here are the steps:

  1. Create your 2 csv files. One csv per language.
  2. Go to All Import > New import.
  3. Press Upload a file and choose your english csv.
  4. Select WooCommerce Products and press Continue to step 2
  5. On step 3, on the WPML Add-on tab, make sure that you select the English (default) language. Also, on the Automatic Record Matching to Translate, select Import data in main language (English).
  6. Finish the steps, and let the plugin import your english products.
  7. Now for the other language, repeat steps 2 to 4.
  8. On step 3, on the WPML Add-on tab, make sure that you select the other language (Greek).  Also, on the Automatic Record Matching to Translate, select Define parent import, select the english CSV and set the unique key (in my case it was the SKU column, common in both language.
  9. Finish the steps, and let the plugin import your greek product translations.

How to export product images from one site to another (when products have the same skus)

  1. Go to the site where you want to get the images.
  2. Create an export with only SKU and Media > Images > URL.
  3. Download the CSV.
  4. Go to the site where you want to insert images.
  5. Create an import with the file that you created in step 3.
  6. Choose Update products.

How to activate WP All Import for users with not administrator privileges (eg. for a shop manager)

  1. Download and activate Capability Manager Enhanced.
  2. Go to Users / Role capabilities.
  3. Select Shop manager and press load.
  4. Tick the manage options checkbox and press Save changes.

How to change the imported prices

First create the desired function and insert in WP All import.

<?php
function change_price($price) {
    if ( !empty( $price ) ) {
        $price = 1.36 * $price;
    }
    return $price;
}
?>

Then go to the price field in your import and add this one:

[change_price({price[1]})]

Check here for the official documentation.

How to export the csv file using MySQL

Open your MySQL database using PHPMyAdmin and use something like that:

SELECT *
FROM `products_table`
WHERE `language_id` = 4
ORDER BY `product_id` ASC
INTO OUTFILE 'C:/products.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'

Post A Comment

Anti-Spam Quiz: