Skip to content

Revert feature name to add_payment_method #60197

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

Merged
merged 3 commits into from
Aug 6, 2025

Conversation

szepeviktor
Copy link
Contributor

@szepeviktor szepeviktor commented Aug 4, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

#57468 Introduced a breaking change: changed feature name from add_payment_method to add_payment_methods
Many WC plugins use add_payment_method

Inspired by @mohsinoffline

@github-actions github-actions bot added type: community contribution plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Aug 4, 2025
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Walkthrough

This change standardizes the use of a payment gateway feature constant throughout the WooCommerce codebase. Specifically, it renames the ADD_PAYMENT_METHODS constant to ADD_PAYMENT_METHOD in the PaymentGatewayFeature enum and updates all references to this constant across several files to use the new singular form.

Changes

Cohort / File(s) Change Summary
Enum Constant Renaming
plugins/woocommerce/src/Enums/PaymentGatewayFeature.php
Renamed the constant ADD_PAYMENT_METHODS to ADD_PAYMENT_METHOD and updated its string value accordingly.
Form Handler Conditional Update
plugins/woocommerce/includes/class-wc-form-handler.php
Updated conditional logic to check for the singular ADD_PAYMENT_METHOD constant instead of the plural form.
Payment Gateways Availability Logic
plugins/woocommerce/includes/class-wc-payment-gateways.php
Modified gateway availability logic to reference the new ADD_PAYMENT_METHOD constant.
Account Functions Menu Logic
plugins/woocommerce/includes/wc-account-functions.php
Changed menu item logic to use the updated ADD_PAYMENT_METHOD constant.
WCPay Promotion Feature Support
plugins/woocommerce/src/Internal/Admin/WCPayPromotion/WCPaymentGatewayPreInstallWCPayPromotion.php
Corrected the supported features array to use the singular ADD_PAYMENT_METHOD constant.
Changelog Entry
plugins/woocommerce/changelog/60197-revert-feature-name
Added a changelog entry documenting the reversion of the feature name to add_payment_method.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abbb1d5 and 84be7e2.

📒 Files selected for processing (1)
  • plugins/woocommerce/changelog/60197-revert-feature-name (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • plugins/woocommerce/changelog/60197-revert-feature-name
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wjrosa wjrosa self-requested a review August 4, 2025 18:13
Copy link
Contributor

github-actions bot commented Aug 4, 2025

Testing Guidelines

Hi ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@wjrosa wjrosa requested review from kalessil and vladolaru August 4, 2025 18:14
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

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

Fix looks good to me! Thank you for your contribution 🙌

@szepeviktor
Copy link
Contributor Author

Glad to contribute.

@kalessil
Copy link
Contributor

kalessil commented Aug 5, 2025

@mohsinoffline, thanks for the heads up in #57468 (comment) 🙌

Can you share some extra context on how you discovered this issue (so we know if we need to do anything beyond merging this PR)?

@szepeviktor
Copy link
Contributor Author

On Slack @mohsinoffline told me about this issue.

@kalessil
Copy link
Contributor

kalessil commented Aug 5, 2025

Gotcha @szepeviktor, and thanks for crafting this PR!

Copy link
Contributor

@kalessil kalessil 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 CI is green!

@kalessil kalessil merged commit b434383 into woocommerce:trunk Aug 6, 2025
65 of 67 checks passed
@github-actions github-actions bot added this to the 10.2.0 milestone Aug 6, 2025
@kalessil kalessil modified the milestones: 10.2.0, 10.1.0 Aug 6, 2025
kalessil added a commit that referenced this pull request Aug 6, 2025
* Revert feature name to add_payment_method
* Create 60197-revert-feature-name

---------

Co-authored-by: Vladimir Reznichenko <kalessil@gmail.com>
@szepeviktor szepeviktor deleted the method-name branch August 6, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants