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

Add filter to convert WooCommerce slug for plugin dependencies #46707

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

chihsuan
Copy link
Member

@chihsuan chihsuan commented Apr 18, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #46169.

When WC is installed in a directory other than woocommerce, the dependent plugins such as WooPayments and WooCommerce Tax can't be activated during the Core Profiler with WP 6.5 due to the slug mismatch.

This PR adds the wp_plugin_dependencies_slug filter to convert the WooCommerce slug to the correct one to fix the issue.

During the testing using live branch, I found that we can't install WooPayments from /wp-admin/plugin-install.php page. The install button is disabled. It seems like the button state is determined using different logic without applying the filter. There is no filter to change the get_plugins() result. We'll need to investigate further.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Fire up a fresh JN using live branch.
  2. Choose Australia as the store location in Core Profiler
  3. Complete the Core Profiler
  4. Go to /wp-admin/plugins.php
  5. confirm WooPayments, WooCommerce Shipping & Tax are activated

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@chihsuan chihsuan self-assigned this Apr 18, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 18, 2024
@chihsuan chihsuan marked this pull request as ready for review April 18, 2024 01:54
@chihsuan chihsuan marked this pull request as draft April 18, 2024 02:59
@chihsuan chihsuan marked this pull request as ready for review April 18, 2024 03:33
@chihsuan chihsuan requested review from a team, adrianduffell and rjchow April 18, 2024 04:22
Copy link
Contributor

github-actions bot commented Apr 18, 2024

Hi @jorgeatorres, @adrianduffell, @rjchow, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

Hi @adrianduffell, @rjchow, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@chihsuan chihsuan force-pushed the fix/unable-activate-dependent-plugins branch from 1bef21f to dc2de46 Compare April 19, 2024 10:24
@chihsuan chihsuan requested review from a team and jorgeatorres and removed request for a team April 19, 2024 10:27
Copy link
Contributor

@adrianduffell adrianduffell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tested well, thanks @chihsuan !

@adrianduffell
Copy link
Contributor

@jorgeatorres Would Proton like to review this solution too?

Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as advertised. Thanks @chihsua!

I left an (optional) suggestion as part of the feedback but I'm preemptively approving.

* @param string $slug The plugin slug to convert.
*
* @return string
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a @since tag to this block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, added in 6dbe049. Thanks!

@chihsuan chihsuan force-pushed the fix/unable-activate-dependent-plugins branch from dc2de46 to 6dbe049 Compare April 30, 2024 01:26
@chihsuan chihsuan enabled auto-merge (squash) April 30, 2024 01:27
@chihsuan chihsuan merged commit fbef56f into trunk Apr 30, 2024
23 of 24 checks passed
@chihsuan chihsuan deleted the fix/unable-activate-dependent-plugins branch April 30, 2024 01:46
@github-actions github-actions bot added this to the 9.0.0 milestone Apr 30, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Apr 30, 2024
@rodelgc rodelgc added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. needs: internal testing Indicates if the PR requires further testing conducted by Solaris plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to activate WC dependent plugins on live branches
4 participants