1
votes

I am working on wordpress with woocommerce. Now i would to change the woocommerce checkout page payment method options that is radio to dropdown.

Currently all my payment options are displaying in radio button option now i would like to change radio buttons into select options.

1

1 Answers

3
votes

you need to look in to review-order.php inside checkout folder, then look for this part of code:

foreach ( $available_gateways as $gateway ) {
                    ?>
    <li class="payment_method_<?php echo $gateway->id; ?>">
        <input id="payment_method_<?php echo $gateway->id; ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>" />
        <label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->get_title(); ?> <?php echo $gateway->get_icon(); ?></label>
        <?php
            if ( $gateway->has_fields() || $gateway->get_description() ) :
                echo '<div class="payment_box payment_method_' . $gateway->id . '" ' . ( $gateway->chosen ? '' : 'style="display:none;"' ) . '>';
                    $gateway->payment_fields();
                echo '</div>';
            endif;
        ?>
    </li>
<?php
}

erase this and change for this code:

echo '<select name="payment_method">';
    foreach ($available_gateways as $gateway) { ?>
         <option value="<?php echo esc_attr( $gateway->id ); ?>"><?php echo $gateway->get_title(); ?> </option>
   <?php  }
echo '</select>';