Still hide checkboxes for single payment options, even if we select a "previously selected" option.

This commit is contained in:
Justin Shreve 2016-07-26 12:37:16 -07:00
parent 1f25dc001b
commit a534512b8a
1 changed files with 5 additions and 5 deletions

View File

@ -58,14 +58,14 @@ jQuery( function( $ ) {
init_payment_methods: function( selectedPaymentMethod ) {
var $payment_methods = $( '.woocommerce-checkout' ).find( 'input[name="payment_method"]' );
// If there is one method, we can hide the radio input
if ( 1 === $payment_methods.length ) {
$payment_methods.eq(0).hide();
}
if ( selectedPaymentMethod ) {
$( '#' + selectedPaymentMethod ).prop( 'checked', true );
} else {
// If there is one method, we can hide the radio input
if ( 1 === $payment_methods.length ) {
$payment_methods.eq(0).hide();
}
// If there are none selected, select the first.
if ( 0 === $payment_methods.filter( ':checked' ).length ) {
$payment_methods.eq(0).prop( 'checked', true );