File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,15 +27,23 @@ initCartFragmentSync();
2727
2828let paypalScriptPromise = null ;
2929
30- const features = [ 'products' ] ;
30+ // Mirror the gateway's server-side (mode-aware) `supports` so WooCommerce Blocks
31+ // does not filter the PayPal method out when the cart requires a feature the
32+ // gateway actually supports — notably `multiple_subscriptions` when the cart holds
33+ // two or more subscriptions. Falls back to the previous hard-coded list.
34+ const features = Array . isArray ( config . supportedFeatures )
35+ ? [ ...config . supportedFeatures ]
36+ : [ 'products' ] ;
3137let blockEnabled = true ;
3238
3339if ( cartHasSubscriptionProducts ( config . scriptData ) ) {
3440 // Show the button only for subscription carts PayPal can process
3541 // (shared rule used by the classic cart and mini-cart as well).
3642 blockEnabled = paypalSubscriptionButtonAllowed ( config . scriptData ) ;
3743
38- features . push ( 'subscriptions' ) ;
44+ if ( ! Array . isArray ( config . supportedFeatures ) ) {
45+ features . push ( 'subscriptions' ) ;
46+ }
3947}
4048
4149if ( blockEnabled ) {
Original file line number Diff line number Diff line change @@ -259,6 +259,10 @@ public function get_payment_method_data() {
259259 'placeOrderButtonText ' => $ this ->place_order_button_text ,
260260 'placeOrderButtonDescription ' => $ this ->place_order_button_description ,
261261 'enabledFundingSources ' => $ funding_sources ,
262+ // The gateway's (mode-aware) supported features, so the block can
263+ // declare them to WooCommerce Blocks and not be filtered out when the
264+ // cart requires one (e.g. `multiple_subscriptions` for 2+ subscriptions).
265+ 'supportedFeatures ' => array_values ( (array ) $ this ->gateway ->supports ),
262266 'ajax ' => array (
263267 'update_shipping ' => array (
264268 'endpoint ' => WC_AJAX ::get_endpoint ( UpdateShippingEndpoint::ENDPOINT ),
You can’t perform that action at this time.
0 commit comments