Skip to content

Treat the new pmpro-paypal Add On as a no-billing gateway#100

Open
dparker1005 wants to merge 1 commit intostrangerstudios:devfrom
dparker1005:feature/support-pmpro-paypal-no-billing
Open

Treat the new pmpro-paypal Add On as a no-billing gateway#100
dparker1005 wants to merge 1 commit intostrangerstudios:devfrom
dparker1005:feature/support-pmpro-paypal-no-billing

Conversation

@dparker1005
Copy link
Copy Markdown
Member

Summary

The new pmpro-paypal Add On (released as 1.1) registers paypal as a checkout gateway and redirects offsite for payment, so no billing address or payment information fields are needed when a member picks PayPal at checkout. Without this change, the donation script's show/hide logic doesn't recognize the paypal slug, so it leaves #pmpro_billing_address_fields and #pmpro_payment_information_fields visible while the user is being redirected offsite.

This adds paypal to both:

  • the PHP-side initial value of pmpro_gateway_billing (includes/checkout.php:133), so the page-load state is correct when ?gateway=paypal is set or when paypal is the primary gateway, and
  • the JS no_billing_gateways array (includes/checkout.php:186), so picking the PayPal radio toggles the fields off correctly at runtime.

The existing 'check' !== gateway carve-out is unaffected — when the user picks PayPal, we fall into that branch and both billing/payment field groups get hidden, which is the desired behavior for an offsite redirect.

Test plan

  • Activate Paid Memberships Pro, the pmpro-donations Add On, and the pmpro-paypal Add On (>= 1.1).
  • Configure a paid membership level with the donation field enabled.
  • With Stripe (or any onsite gateway) as the primary gateway and PayPal credentials saved on pmpro-paypal, visit the checkout page.
  • Selecting the PayPal radio hides both #pmpro_billing_address_fields and #pmpro_payment_information_fields. Switching back to the primary radio restores them.
  • Entering a donation amount with PayPal selected does not make the billing fields reappear (the donation should still flow through PayPal offsite).
  • With paypal as the primary gateway, the donation field still works and billing/payment fields stay hidden on initial load.
  • Existing behavior with paypalexpress, twocheckout, check, and paypalstandard is unchanged.

🤖 Generated with Claude Code

The pmpro-paypal Add On (1.1+) registers `paypal` as a checkout
gateway and redirects offsite for payment, so the donation script's
billing-fields UI should treat it the same as paypalexpress: no
billing address or payment information fields are needed when paypal
is selected.

Add `paypal` to both the PHP-side initial pmpro_gateway_billing
decision and the runtime no_billing_gateways list so the donation
field's show/hide logic works correctly when a member picks PayPal at
checkout via the new Add On.

Co-Authored-By: Claude Opus 4.7 (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