Skip to content

Standalone levels and guest checkout - #3636

Draft
dparker1005 wants to merge 1 commit into
strangerstudios:v4.0from
dparker1005:guest-checkout-level-flags
Draft

Standalone levels and guest checkout#3636
dparker1005 wants to merge 1 commit into
strangerstudios:v4.0from
dparker1005:guest-checkout-level-flags

Conversation

@dparker1005

Copy link
Copy Markdown
Member

Summary

  • Adds Standalone Level setting: one-time purchases that don't assign a membership, don't cancel existing memberships, and can always be repurchased. Ideal for donations, gifts, event tickets, etc.
  • Adds Allow Guest Checkout setting (on standalone levels): lets users check out without creating a WordPress account.
  • All standalone and guest checkout logic lives in a single new file includes/standalone-levels.php, hooked into core via filters and actions.
  • Adds general-purpose hooks and filters that are useful beyond standalone/guest checkout.

Still TODO

  • Wording and UX during standalone checkout (email templates still reference "membership")
  • Wording and UX when a purchase has been completed as a guest
  • Ensure Add Ons handle orders and checkouts without user IDs gracefully
  • Consider hiding billing/expiration/recurring fields on the edit level page when standalone is checked
  • Consider dedicated email templates for standalone/guest checkouts
  • Test with all payment gateways
  • Test with key Add Ons (Donations, Gift Levels, Sponsored Members)

Test plan

  • Create a membership level, check "Standalone Level" under Other Settings
  • Verify the levels list shows "Standalone level. No membership assigned." in the cost column
  • Check out for the standalone level while logged in — verify no membership assigned, redirected to invoice page
  • Check "Allow Guest Checkout", check out while logged out with the guest checkbox — verify no user created, order saved with guest_email in meta, redirected to invoice page with email access
  • Verify guest order shows guest email in admin orders list and order view sidebar
  • Verify recurring billing is blocked on standalone levels

🤖 Generated with Claude Code

Adds two new per-level settings under Other Settings on the edit level page:
- Standalone Level: one-time purchase, no membership assigned, no cancellations,
  always repurchasable.
- Allow Guest Checkout: lets users check out without creating an account.
  Only available on standalone levels.

Core changes:
- New file includes/standalone-levels.php with all standalone and guest
  checkout logic hooked via filters and actions.
- pmpro_checkout_skip_level_change filter in pmpro_complete_checkout() to
  skip level assignment.
- pmpro_skip_user_creation filter in checkout preheader to skip user
  validation and creation.
- pmpro_checkout_email_user filter to provide a WP_User for guest emails.
- pmpro_checkout_level_name_text filter for the level name paragraph at
  checkout.
- pmpro_checkout_before_account_fields action for the guest checkbox.
- pmpro_allow_viewing_order filter on the invoice preheader for guest
  invoice access.
- pmpro_orders_column_after_user action and pmpro_order_view_after_member_info
  action for guest order admin display.
- Stripe gateway: null-safe fallback to billing data in
  update_customer_at_checkout().
- Email templates: use getMembershipLevelAtCheckout() instead of manual
  user/DB lookups.
- Levels list: use short cost format, always call pmpro_getLevelCost().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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