Product Variation post_parent Set Incorrectly From WooCommerce Import Suite

September 6th, 2013 - Posted by Steve Marks to PHP, Software, Web Development.

I’ve posted quite a lot recently about WooCommerce. It really is my first point of call when building an e-commerce solution in WordPress. In my latest project I’ve been dealing with a site that contains thousands of product variations which, to manage manually, is not feasible and would just take too long.

As a result I’ve turned to the WooCommerce Product CSV Import Suite to help me out. It’s a little steep at $199 dollars but, with the amount of hours of blood, sweat and tears it will prevent, it’s definitely a worthwhile investment in my eyes.

Anyway, enough about WooCommerce itself. If you’re reading this post you probably already know about, and are using, the Import Suite but you’ve come across the problem I mention in the title of this post; When importing product variations, the post_parent field is being imported incorrectly. I honestly struggled with this for hours and only managed to work out what was going on by delving into and debugging the plugin code itself.

Allow me to explain the scenario:

Let’s imagine that the first columns of my spreadsheet of product variations looks like so:


Looks ok right? I’ve got the post_parent field set as 184, and the other columns all filled in accordingly. When I imported this spreadsheet however, the post_parent wasn’t being set to 184 at all, and was instead being set to the ID of a completely separate product.

The Solution

After looking inside the CSV Import Suite plugin code and stepping through what it does upon import, I managed to find out that it was caused due to me having a blank parent_sku field in the spreadsheet. Because of this it was completely ignoring the post_parent that I’d filled in and was instead looking up which product had the same SKU. In my case I don’t use SKU’s so it was picking the first/wrong product ID.

That aside there are two ways to solve this:

1. Remove the parent_sku field from the spreadsheet:


2. Select ‘Do Not Import’ for the parent_sku field when mapping the fields to import


This entry was posted on Friday, September 6th, 2013 at 11:30 am by +Steve Marks and is filed under PHP, Software, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first