From ec1d44c74283c323121c28d3445416f2d200bfba Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 15 Jan 2019 12:14:55 +0000 Subject: [PATCH] Prevent selected payment method description box from sliding up Closes #21770 --- assets/js/frontend/checkout.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/frontend/checkout.js b/assets/js/frontend/checkout.js index 75a5c7110c8..d367bd791a5 100644 --- a/assets/js/frontend/checkout.js +++ b/assets/js/frontend/checkout.js @@ -77,10 +77,12 @@ jQuery( function( $ ) { $payment_methods.eq(0).prop( 'checked', true ); } - if ( $payment_methods.length > 1 ) { + // Get name of new selected method. + var checkedPaymentMethod = $payment_methods.filter( ':checked' ).eq(0).prop( 'id' ); + if ( $payment_methods.length > 1 ) { // Hide open descriptions. - $( 'div.payment_box' ).filter( ':visible' ).slideUp( 0 ); + $( 'div.payment_box:not(".' + checkedPaymentMethod + '")' ).filter( ':visible' ).slideUp( 0 ); } // Trigger click event for selected method