Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

declare_compatibility() not compatible with composer #864

Open
sbolinger-godaddy opened this issue May 28, 2024 · 2 comments
Open

declare_compatibility() not compatible with composer #864

sbolinger-godaddy opened this issue May 28, 2024 · 2 comments
Milestone

Comments

@sbolinger-godaddy
Copy link
Contributor

Describe the bug

When the plugin is installed via composer, this HPOS compatibility function throws errors in WooCommerce.

FeaturesUtil::declare_compatibility: /wp-content/plugins/enhanced-checkout-woocommerce/vendor/wp-graphql/wp-graphql-woocommerce/wp-graphql-woocommerce.php is not a known WordPress plugin.

That second parameter: FILE typically corresponds to a path like wp-content/plugins/wp-graphql-woocommerce/wpgraphql-woocommerce.php -- as in, a path for a normal WordPress plugin.

But when it's installed as a composer dependency, it's actually going to be: wp-content/plugins/enhanced-checkout-woocommerce/vendor/wp-graphql/wp-graphql-woocommerce/wpgraphql-woocommerce.php
(inside /vendor/ and nested quite deep!)

The problem is that inside that WooCommerce function that they're using (FeaturesUtil::declare_compatibility()) WooCommerce validates that the provided file path is inside the list of currently active plugins that WordPress recognizes (everything ONLY inside wp-content/plugins one layer deep).

In this case, WpGraphQL doesn't meet that criteria. That's when WooCommerce automatically logs the error.

Proposed Solution

Remove this compatibility function. When installed via composer, this should be the job of the parent plugin.

To Reproduce

Steps to reproduce the behavior:

  1. Bundle this plugin via composer into another plugin
  2. Install and activate WooCommerce and your plugin
  3. Visit WooCommerce logs to see the errors

Thanks!

@kidunot89 kidunot89 added this to the v0.20.1 milestone Jun 12, 2024
@kidunot89
Copy link
Member

@sbolinger-godaddy Implementing the solution shouldn't be too much of an issue. I've added this into the next release's milestone and it should be resolved in the next release. Sorry about any inconveniences this may have caused.

@sbolinger-godaddy
Copy link
Contributor Author

@kidunot89 Thanks so much Geoff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants