humanmade / WordPress-Importer

In-development rewrite of the WordPress (WXR) Importer
Other
358 stars 63 forks source link

Not working with WooCommerce? #63

Open daviedR opened 8 years ago

daviedR commented 8 years ago

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

lukecav commented 8 years ago

An example XML file would be handy to have.

ntwb commented 8 years ago

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

daviedR commented 8 years ago

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?

ntwb commented 8 years ago

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

daviedR commented 8 years ago

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 commented 8 years ago

It should have this:

image

daviedR commented 8 years ago

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.

andreiglingeanu commented 5 years ago

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.