Skip to content

Fix PayPal subscription buttons with a saved Card only layout - #3783

Open
Crabcyborg wants to merge 4 commits into
masterfrom
fix/paypal-recurring-card-only-layout
Open

Crabcyborg wants to merge 4 commits into
masterfrom
fix/paypal-recurring-card-only-layout

Conversation

@Crabcyborg

Copy link
Copy Markdown
Contributor

Switching a PayPal payment action from one-time to recurring hides the layout setting but keeps its saved value. If the layout was Card only, the frontend skipped subscription buttons and the form could show “No payment methods available.”

Allow recurring actions to discover PayPal buttons regardless of the saved layout. The regression test exercises the initializer with a recurring action and a saved Card only layout.

The PayPal bootstrap tests pass locally. Live PayPal sandbox rendering is unverified.

Related report from Garret:
#3725 (comment)

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 85479d8 and f1a737e.

Files selected for processing: 2

  • paypal/js/frontend.js
  • tests/js/paypalBootstrap.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@deepsource-io

deepsource-io Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 85479d8...f1a737e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Dec 2, 2026 1:43p.m. Review ↗
JavaScript Dec 2, 2026 1:43p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment on lines +100 to +104
discoverPaymentMethods: async ( { buttonsAreEnabled } ) => {
if ( buttonsAreEnabled ) {
methods.set( 'paypal', { eligible: true, render: async () => {} } );
}
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Found `async` function without any `await` expressions


A function that does not contain any await expressions should not be async (except for some edge cases in TypeScript which are discussed below). Asynchronous functions in JavaScript behave differently than other functions in two important ways:

discoverPaymentMethods: async () => methods.set( 'paypal', { eligible: true, render: async () => {} } ),
discoverPaymentMethods: async ( { buttonsAreEnabled } ) => {
if ( buttonsAreEnabled ) {
methods.set( 'paypal', { eligible: true, render: async () => {} } );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unexpected empty async method 'render'


Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.

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

Successfully merging this pull request may close these issues.

1 participant