Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WooCommerce cart-shipping.php模板-单选按钮而不是选择框_Php_Wordpress_Templates_Woocommerce_Cart - Fatal编程技术网

WooCommerce cart-shipping.php模板-单选按钮而不是选择框

WooCommerce cart-shipping.php模板-单选按钮而不是选择框,php,wordpress,templates,woocommerce,cart,Php,Wordpress,Templates,Woocommerce,Cart,我在WooCommerce模板中看到默认的cart shipping.php: <select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method"> <?php foreach ( $avail

我在WooCommerce模板中看到默认的
cart shipping.php

<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>

可能是,您没有正确的
woocommerce/cart/cart shipping.php的模板版本,因为我看不到您的代码,但这一个(已经有单选按钮)

因此,原因可能是您的主题中有一个定制的woocommerce模板的旧版本
这是
cart shipping.php
actual代码(模板版本2.5.0)的摘录:

  •         <ul id="shipping_method">
                <?php foreach ( $available_methods as $method ) : ?>
                    <li>
                        <?php
                            printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />
                                <label for="shipping_method_%1$d_%2$s">%5$s</label>',
                                $index, sanitize_title( $method->id ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ), wc_cart_totals_shipping_method_label( $method ) );
                            do_action( 'woocommerce_after_shipping_rate', $method, $index );
                        ?>
                    </li>
                <?php endforeach; ?>
            </ul>