WordPress-Importer icon indicating copy to clipboard operation
WordPress-Importer copied to clipboard

Not working with WooCommerce?

Open daviedR opened this issue 8 years ago • 8 comments

Hi @rmccue

Does this plugin works with WooCommerce? I have an XML file, contains all blog posts, pages, WooCommerce products (variable products), and product attributes (I have an attribute). I tried to import them but the attributes was not imported. When you go to Products > Attributes menu, it's blank. This causes product variants not imported completely as well.

I tried the old WordPress importer and it works fine. I can give you the XML file if you need to test it.

Regards, David

daviedR avatar Jun 24 '16 16:06 daviedR

An example XML file would be handy to have.

lukecav avatar Jun 27 '16 20:06 lukecav

WooCommerce include WXR dummy data in the plugin, this is probably the best data source to test with: https://docs.woothemes.com/document/importing-woocommerce-dummy-data/ https://github.com/woothemes/woocommerce/tree/master/dummy-data

ntwb avatar Jun 27 '16 23:06 ntwb

Just tested the dummy data (dummy-data.xml) from WooCommerce using the WordPress Importer v2. It failed to import the Color attribute.

Any fix on this?

daviedR avatar Jun 28 '16 16:06 daviedR

Which "Color attribute" wasn't imported? The category, taxonomy or postmeta "Color attribute"?

ntwb avatar Jun 28 '16 23:06 ntwb

Hi @ntwb

You can go to Products > Attributes. There is no "color" attribute imported. Well, in the process, you would see "Failed to import pa_color ..." warning message, and the progress bar will end up on 97% instead of 100% complete.

Try to import using the old WordPress Importer, and you would see "color" attribute in the Products > Attributes menu.

When attributes were not imported, your Variable products would lose all the variants, they would be not detected by WordPress.

daviedR avatar Jun 29 '16 01:06 daviedR

It should have this:

image

daviedR avatar Jun 29 '16 10:06 daviedR

I found where the issue is. WordPress Importer provide action hook called import_start. WooCommerce take advantage of this hook to manually create the custom attribute taxonomies.

If you go to includes/admin/class-wc-admin-importer.php file in WooCommerce plugin, function post_importer_compatibility, it has a conditional check if class WXR_Parser is available. This class is available on old WordPress Importer, but not in WordPress Importer v2. That's why the action was skipped.

Bot sure how to fix this, since the check is on WooCommerce end.

daviedR avatar Jun 30 '16 05:06 daviedR

I can confirm this is still an issue. And the stuff mentioned by @daviedR is just half the solution, it seems.

When I manually create the needed attributes and run the importer, the variations do not get imported properly. But, if I run the old importer (with post_importer_compatibility() from WooCommerce commented out for trying to dissect the problem) and manually created attributes -- variations appear just fine.

I'd love to go deeper into the importer code and try to figure out the differences between the two implementations, but I'm a bit short on time at the moment. If someone is willing to give me some pointers on what features this new importer lacks compared to the old one, I'd be happy to resume my searches. For now, I've given up on this effort.

andreiglingeanu avatar Jul 31 '19 12:07 andreiglingeanu