Insonsistent PayPal button behavior for subscriptions on cart (6639)#4542
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 🔗 Test this pull request with WordPress Playground What's included:
Login credentials:
Plugin Details:
🤖 Auto-generated for commit 5207862 • Last updated: 2026-07-21T08:02:43.087Z |
Narek13
left a comment
There was a problem hiding this comment.
Thanks for working on this. Left a small suggestion
| debounce( () => { | ||
| this._handleStoreCartChange(); | ||
| }, 300 ) | ||
| ); |
There was a problem hiding this comment.
This fires on every store change, not just wc/store/cart.
subscribe() accepts an optional storeNameOrDescriptor second argument to scope the listener to one store like wp.data.subscribe(callback, 'wc/store/cart')
The PayPal button behaved inconsistently for subscription carts. On the block cart it showed for one subscription product but appeared then disappeared when a second (free-trial) one was added; on the classic cart the opposite happened (hidden for one, shown for two). Separately, emptying the block cart left the mini-cart still showing products.
PR Changes
SubscriptionHelper::paypal_subscription_button_allowed()(PHP) andpaypalSubscriptionButtonAllowed()(JS), exposed as onesubscription_button_allowedserver flag. It covers both modes: PayPal Subscriptions requires a single item with a PayPal plan; vaulting requires vaulting enabled; non-subscription carts are always allowed.