Forum Replies Created

Viewing 1 replies (of 1 total)
  • DRAGOS

    (@dragosstancu)

    It’s quite easy, you need to use the templates.

    In woocommerce/cart/cart-shipping.php replace the code for rendering radio buttons with the code to print the select control (I commented the radio buttons section below):

    <?php elseif ( get_option( 'woocommerce_shipping_method_format' ) === 'select' ) : ?>
    
    				<select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method">
    					<?php foreach ( $available_methods as $method ) : ?>
    						<option value="<?php echo esc_attr( $method->id ); ?>" <?php selected( $method->id, $chosen_method ); ?>><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></option>
    					<?php endforeach; ?>
    				</select>
    
    			<?php else : ?>
    
    				<!-- <ul id="shipping_method">
    					<?php foreach ( $available_methods as $method ) : ?>
    
    <li>
    							<input type="radio" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>" value="<?php echo esc_attr( $method->id ); ?>" <?php checked( $method->id, $chosen_method ); ?> class="shipping_method" />
    							<label for="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>"><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></label>
    						</li>
    					<?php endforeach; ?>
    				 -->
    
    				<select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method">
    					<?php foreach ( $available_methods as $method ) : ?>
    						<option value="<?php echo esc_attr( $method->id ); ?>" <?php selected( $method->id, $chosen_method ); ?>><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></option>
    					<?php endforeach; ?>
    				</select>
    
    			<?php endif; ?>
Viewing 1 replies (of 1 total)