Skip to content

Fix PayPal button ignoring the Blue color - #3725

Open
vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-7004-paypal-button-color
Open

vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-7004-paypal-button-color

Conversation

@vivi-the-going-merry

@vivi-the-going-merry vivi-the-going-merry Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What was broken

createPayPalButton() only keeps a button color that is in an allow list: silver, black, white, plus per-funding-source extras. There was no paypal entry, so Blue (and Gold) were deleted for the PayPal button and it always rendered gold.

What changed

  • paypal/js/frontend.js: added paypal: [ 'gold', 'blue' ] to supportedColorsMap.
  • tests/js/paypalBootstrap.test.mjs: runs the real createPayPalButton() and checks the PayPal button keeps all five colors and that an unsupported color (Venmo + gold, PayPal + an unknown value) is still dropped.

How it was verified

  • Red: JS unit tests failed on the test-only commit (expected: 'gold').
  • Green: JS unit tests and Oxlint pass on the head commit; all other checks that ran are green.
  • Not tested: a real PayPal sandbox render. The issue reports PayPal's SDK rendered a blue fundingSource: "paypal" button with style.color: "blue".

After merge

The KB page (formidableforms.com/knowledgebase/formidable-paypal/) still says only Silver, White and Black change the PayPal button; the issue asks for that note to be removed.

Fixes Strategy11/formidable-pro#7004

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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 Nov 19, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in d4bf9a3...7154905 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:56p.m. Review ↗
JavaScript Dec 2, 2026 1:56p.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.

config = buttonConfig;
}
},
onApprove() {},

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 method 'onApprove'


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.

}
},
onApprove() {},
onError() {},

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 method 'onError'


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.

},
onApprove() {},
onError() {},
onCancel() {},

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 method 'onCancel'


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.

onApprove() {},
onError() {},
onCancel() {},
createOrder() {},

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 method 'createOrder'


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.

onError() {},
onCancel() {},
createOrder() {},
createSubscription() {},

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 method 'createSubscription'


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.

Comment thread tests/js/paypalBootstrap.test.mjs Outdated
createOrder() {},
createSubscription() {},
};
runInNewContext( source.slice( start, end ) + '\ncreatePayPalButton( fundingSource, false );', { ...context, fundingSource } );

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 string concatenation


In ES2015 (ES6), we can use template literals instead of string concatenation.

@vivi-the-going-merry vivi-the-going-merry Bot changed the title Fix PayPal button ignoring Blue color Fix PayPal button ignoring the Blue color Nov 19, 2026
@vivi-the-going-merry
vivi-the-going-merry Bot marked this pull request as ready for review November 19, 2026 15:03
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 19, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve. The fix is one line and correct: createPayPalButton( paypal.FUNDING.PAYPAL, … ) had no entry in supportedColorsMap, so Gold and Blue fell through to delete buttonConfig.style.color. Adding paypal: [ 'gold', 'blue' ] matches the Color dropdown in paypal/views/settings/button-settings.php and PayPal's documented colors for the PayPal button. Venmo and Pay Later behavior is unchanged.

Tests run: node --test tests/js/paypalBootstrap.test.mjs at 9af76e1 → 7/7 pass. With paypal/js/frontend.js reverted to the pre-fix commit and the same test file, the new color test fails (expected: 'gold', actual: undefined), so it covers the bug. CI's JS unit tests is also green at this head.

Not run: a real PayPal sandbox render of the blue button. I ran the real createPayPalButton() before and after, which shows the config passed to paypal.Buttons() now keeps color: 'blue'; the SDK's own rendering of that config isn't something I exercised.

The issue's KB follow-up (remove the "only Silver, White and Black" note) is already listed under "After merge".

@garretlaxton

Copy link
Copy Markdown

With Layout set to "Card only", the form preview shows "No payment methods available."
image

@Crabcyborg

Copy link
Copy Markdown
Contributor

@garretlaxton That sounds like a separate issue. I have a new PR here #3783. I believe it's a conflict between settings when you have it set to card only with recurring payments set, which doesn't support cards currently.

Can you try that PR?

Thank you!

@vivi-the-going-merry vivi-the-going-merry Bot added vivi-working Vivi is actively working this and removed vivi-pickup labels Dec 2, 2026
vivi-the-going-merry Bot and others added 3 commits December 2, 2026 06:56
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vivi-the-going-merry
vivi-the-going-merry Bot force-pushed the fix/issue-7004-paypal-button-color branch from 9af76e1 to 7154905 Compare December 2, 2026 13:56
@vivi-the-going-merry vivi-the-going-merry Bot added franky-review and removed vivi-working Vivi is actively working this labels Dec 2, 2026
@vivi-the-going-merry

Copy link
Copy Markdown
Contributor Author

Method: in-place push (rebase, force-push)
Pushed to: #3725 (branch fix/issue-7004-paypal-button-color, unchanged PR number)

The branch was conflicting with master. The only conflict was tests/js/paypalBootstrap.test.mjs: #3725 and the cancelled-pop-up fix (ccb598fc0) both appended tests at the end of the file. I kept both sets. The fix commit (paypal: [ 'gold', 'blue' ]) is unchanged.

Tested: node --test tests/js/paypalBootstrap.test.mjs on the rebased head: 10/10 pass. Not run: the rest of CI, which starts on this push; a PayPal sandbox render.

The "Card only" report above is a different bug (#3783), not this PR.

config = buttonConfig;
}
},
onApprove() {},

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 method 'onApprove'


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.

}
},
onApprove() {},
onError() {},

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 method 'onError'


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.

},
onApprove() {},
onError() {},
onCancel() {},

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 method 'onCancel'


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.

onApprove() {},
onError() {},
onCancel() {},
createOrder() {},

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 method 'createOrder'


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.

onError() {},
onCancel() {},
createOrder() {},
createSubscription() {},

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 method 'createSubscription'


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.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Dec 2, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve. Re-review at 7154905 (my Approve was at 9af76e1); the head moved only because Vivi rebased onto master to resolve a conflict in tests/js/paypalBootstrap.test.mjs.

  • git range-diff of the old and new heads shows all three commits unchanged apart from diff context. The fix is still the single line paypal: [ 'gold', 'blue' ] in supportedColorsMap, and the whole PR diff is those two files.
  • Tests run: node --test tests/js/paypalBootstrap.test.mjs at 7154905 → 10/10 pass. With paypal/js/frontend.js put back to master's version, the new color test fails (expected: 'gold', actual: undefined), so it still catches the bug.
  • node --test tests/js/*.test.mjs (the CI command) → 96/102 in my scratch checkout; the same six files (choiceDeleteLogic, inlineSubmitAlignment, optionGroupRename, optionGroupValues, squareVerifyBuyer, style-live-preview) fail on master too, so they are not from this PR.
  • Not run: a real PayPal sandbox render of the blue button. The test runs the real createPayPalButton() and shows the config handed to paypal.Buttons() keeps color: 'blue'; the SDK's own rendering isn't something I exercised.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Dec 2, 2026
@garretlaxton

Copy link
Copy Markdown

Formidable Stripe and PayPal conflict on the same form. With the Stripe add-on active, the "Payment Method" field that should be hidden appears, with two options both labelled "Payment". The Payment area also showed a Stripe card field instead of the PayPal button on some loads but not others. This looks pre-existing though and not new in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants