Merge pull request #3395 from woocommerce/PCP-4449-pay-pal-button-greyed-out-on-single-product-page-for-variable-products-with-2-attributes-with-the-old-ui

PayPal button greyed out on single product page for variable products with 2+ attributes with the old UI.  (4449)
This commit is contained in:
Emili Castells 2025-05-28 16:10:11 +02:00 committed by GitHub
commit b5ea07bcf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -162,12 +162,16 @@ class SingleProductBootstrap {
}, },
] ]
.map( ( f ) => f() ) .map( ( f ) => f() )
.sort((a, b) => { .filter( ( val ) => val !== null && val !== undefined )
if (parseInt(a.replace(/\D/g, '')) < parseInt(b.replace(/\D/g, '')) ) { .sort( ( a, b ) => {
if (
parseInt( a.replace( /\D/g, '' ) ) <
parseInt( b.replace( /\D/g, '' ) )
) {
return 1; return 1;
} }
return -1; return -1;
}) } )
.find( ( val ) => val ); .find( ( val ) => val );
if ( typeof priceText === 'undefined' ) { if ( typeof priceText === 'undefined' ) {