Self-heal stale membership plan slugs in getMembershipPlan#88
Merged
Conversation
v1.4.4 (commit 0161e59) changed getMembershipPlanId() to compose IDs from label_frequency_currency. The frontend now submits the new-format ID, but plans saved before the upgrade still live in the WP options table under the old label-only key. Until an admin re-saves the settings page, /stripe/create-subscription throws "Selected plan is not in the list of plans" and no one can buy a membership. Make getMembershipPlan() fall back to scanning all ck_join_flow_membership_plan_* options and matching by recomputed ID. Test pins the production failure mode and the negative-match guard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A critical bug is currently preventing anyone from buying a membership tier on sites running v1.4.4+ of the plugin. The
/stripe/create-subscriptionendpoint throwsSelected plan is not in the list of plans, this is unexpectedfor every new sign-up. Reported live on tenantsunion.org.uk on 2026-05-01.Root cause
Commit 0161e59 (v1.4.4, "Fix multi-currency without explicit plan IDs") changed
Settings::getMembershipPlanId()to compose IDs fromlabel_frequency_currencyinstead of justsanitize_title($label):low-wage-payment-levellow-wage-payment-level_monthly_gbpThe frontend dropdown began submitting the new-format ID immediately, but plans saved to
wp_optionsbefore the upgrade still live under the old label-only key (ck_join_flow_membership_plan_low-wage-payment-level).Settings::getMembershipPlan()does a singleget_option()lookup, finds nothing, returnsfalse, andjoin.php:492throws.Plans are only re-keyed when an admin opens the Carbon Fields settings page and clicks Save (which calls
Settings::saveMembershipPlans()). On every site that upgraded to 1.4.4+ without that step, sign-ups silently broke.Renewals continued working because
customer.subscription.updated/invoice.paidwebhooks resolve plans viagetMembershipPlanByPriceId(a Stripe price ID lookup, not a slug lookup), which is why the failure was hard to spot in the logs.Fix
Make
Settings::getMembershipPlan()self-heal across the slug-format change. After a directget_option()miss, scan allck_join_flow_membership_plan_*options, recompute each plan's ID viagetMembershipPlanId(), and return the match. The fast path (direct hit) is preserved unchanged.This means the plugin no longer requires a manual settings re-save to recover from the v1.4.4 upgrade, and protects against any future slug-format change.