My current workaround is to call the init function above my code but I think you can just register the export columns a bit earlier directly within a constructor. I see no need for a admin_init
hook here…
$gzd_product_csv_exporter = new WC_GZD_Product_Export();
$gzd_product_csv_exporter->init();
Hi,
seems to be working now! Can you ship it within the next update?
Cheers
Hi there,
yes, the improvement will be included automatically.
Cheers
Hey,
sorry for getting back to this topic. I’ve found another issue! Now the timing works perfectly, but when I use the WooCommerce exporter class within a Cron job or backend function for example, your exporter class don’t gets loaded because it’s within an is_admin()
check within the woocommerce-germanized.php
file.
Any chance you can move the exporter & importer include out of this check?
include_once WC_GERMANIZED_ABSPATH . 'includes/export/class-wc-gzd-product-export.php';
include_once WC_GERMANIZED_ABSPATH . 'includes/import/class-wc-gzd-product-import.php';
is_admin()
only resolves when you are actually on an admin page, which is not the fact at a backend function :/
Otherwise, when I get the default exports columns for WooCommerce within my plugin (used by over 100 people for Collmex WaWi) during a Cron job for an automatic product import, your columns are missing and an error occurs during the import.
Since my plugin supports Germanized, it would be very bad, if the columns are missing in this case.
If there is no chance you can move the includes out of the check, please let me know. In this case, I need to do the include during the Cron job by myself. But I think, this case can happen more often and not only within my plugin.
Hi there,
we are handling this the same way Woo handles the includes. The WC_Admin class (which registers and includes the exporters) is only included via admin requests (checked via is_admin
). How do you actually solve that? Do you manually include the exporters?
You might of course include the file(s) manually.
Cheers
Hi,
actually, the includes I’m talking about are included within this file:
wp-content/plugins/woocommerce-germanized/woocommerce-germanized.php
Since I’m including the importer from WooCommerce within my plugin, all extensions to the importer should be included automatically. If I do this within a backend function which gets not called via the admin dashboard, your includes are failing and I’m getting an WooCommerce importer without your export columns.
Cheers
Since I’m including the importer from WooCommerce within my plugin, all extensions to the importer should be included automatically
Unfortunately that is not possible as Woo does not offer hooks which could be used to auto-magically include files whenever an import/export class is instantiated.
I’ve just updated the code to include those files during cron requests too:
https://github.com/vendidero/woocommerce-germanized/commit/d4897574f46cff9353dab97fdab00b8b18158d7f
Cheers
Awesome! This works. I’ve left a comment with a suggestion 🙂 Thanks a lot!
Hi!
I just saw your 3.8.5 update. Sadly, this fix seems to be missing. Do you have any information about the release date? Currently, I’m not able to release my plugin because otherwise a lot of people will have issues regarding an important function.
Cheers
I just saw your 3.8.5 update. Sadly, this fix seems to be missing. Do you have any information about the release date?
It is scheduled for our 3.9 update which will (probably) be released this month.
Cheers