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

Adding a new feature flag and setting to control SPE #3988

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Feb 26, 2025

Fixes #3892

Changes proposed in this Pull Request:

This PR introduces a new feature flag (_wcstripe_feature_spe) to control the Single Payment Element availability. This flag controls the feature as a whole, and does not behave like an option.

When the flag is enabled, and the legacy checkout experience is disabled, you should be able to toggle the "Single payment element" feature in settings. When the flag is disabled, the option is not displayed.

Testing instructions

  • Checkout and build this branch on your test environment (add/spe-feature-flag)
  • Connect your Stripe account
  • Enable the new feature flag (_wcstripe_feature_spe). You can do it by either hardcoding the return value of is_spe_available to true or by running npm run wp option update _wcstripe_feature_spe 'yes'
  • As a merchant, disable the legacy checkout experience in settings (wp-admin/admin.php?page=wc-settings&tab=checkout&section=stripe&panel=settings)
  • Confirm that you can see the new "Single payment element" setting:
Screenshot 2025-02-27 at 10 40 54
  • Confirm that you can toggle it and that the value you set persists upon page refresh
  • Disable the _wcstripe_feature_spe feature flag
  • Confirm that the option is gone even when the legacy checkout experience is disabled

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@wjrosa wjrosa self-assigned this Feb 26, 2025
@wjrosa wjrosa marked this pull request as ready for review February 27, 2025 13:41
@wjrosa wjrosa requested review from a team and Mayisha and removed request for a team February 27, 2025 13:46
@wjrosa wjrosa changed the title Adding a new feature flag to control SPE Adding a new feature flag and setting to control SPE Feb 27, 2025
Copy link
Contributor

@Mayisha Mayisha left a comment

Choose a reason for hiding this comment

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

@wjrosa thanks for adding this. The changes are mostly working except the saving part.

✅ SPE checkbox is displayed when the feature flag is enabled.
✅ SPE checkbox is hidden when the feature flag is disabled.
✅ SPE checkbox is disabled when legacy is enabled.
⚠️ Enabling the SPE checkbox does not persist on page refresh.

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.

SPE: Add feature flag
2 participants