Woocommerce: WC_Dependencies support when WC in different directory

Created on 2 Jun 2016  路  3Comments  路  Source: woocommerce/woocommerce

There's widely used WC_Dependencies class by plugins which are extending WooCommerce for checking if WC is active. Unfortunately woocommerce_active_check() method works only when WooCommerce is sitting in default woocommerce directory.

We use WordPress multisite in our company and we need different versions of WC for different websites (eg. running stable and beta at the same time). Enabling just WC in different directory is not a problem of course, but then external plugins are not loaded, as dependency check shows that WC is not enabled. It basically makes impossible to run different WC versions simultaneously with extensions working correctly for different websites across the network.

I know that's not a question touching WC core directly but as @woothemes plugins are using WC_Dependencies too, I'm asking here and maybe you know solution for this problem?

Other idea would be to modify this class in the way which gives developers possibility to keep WooCommerce in different directory and encourage 3rd parties to adapt it in their plugins.

Most helpful comment

In honesty it may be better to drop it and use plugins_loaded hook and do a class check instead of using this class if thats possible. But thats an issue to discuss in the updater repo.

With the existing codebase, WordPress uses the woocommerce/woocommerce.php identifier which is why the check works as it does. We could just check for 'woocommerce.php' instead of the full path perhaps.

CC'ing @mattyza and @akeda to see this, and closing as it's not related to WC core, but premium extensions.

All 3 comments

I would say the dependency check for a slug name could be filterable by an early loading mu-plugin.

In honesty it may be better to drop it and use plugins_loaded hook and do a class check instead of using this class if thats possible. But thats an issue to discuss in the updater repo.

With the existing codebase, WordPress uses the woocommerce/woocommerce.php identifier which is why the check works as it does. We could just check for 'woocommerce.php' instead of the full path perhaps.

CC'ing @mattyza and @akeda to see this, and closing as it's not related to WC core, but premium extensions.

Thanks for taking a look @mikejolley. May I ask where the updater repo is located at so we could follow progress on this topic? Searching woothemes/ for update is a blank result.

Was this page helpful?
0 / 5 - 0 ratings