“Ubah kotak centang pengiriman ke tombol radio” Kode Jawaban

Ubah kotak centang pengiriman ke tombol radio

if ( ! function_exists( 'toggle_shipping_address' ) ){
    function toggle_shipping_address(){
        global $post;
        if($post->post_name === 'checkout'){
        ?>
        <script type="text/javascript">
        jQuery(document).ready(function($){
            $('.radio-toggle .input-radio').change(function(){
                var curval = ($(this).val() === '0') ? true : false;
                $('#ship-to-different-address-checkbox').prop('checked', curval);
                $('#ship-to-different-address-checkbox').trigger('click');
            });
        });
        </script>
        <?php
        }
    }
}
add_action( 'wp_footer', 'toggle_shipping_address' );
Disgusted Dingo

Ubah kotak centang pengiriman ke tombol radio

<h3 class="radio-toggle">
    <span><?php _e( 'Ship to a different address?', 'woocommerce' ); ?></span>
    <label class="woocommerce-form__label woocommerce-form__label-for-radio radio" style="margin-left:15%;">
        <input id="ship-to-different-address-radio-yes" class="woocommerce-form__input woocommerce-form__input-radio input-radio" type="radio" name="ship_to_different_address_radio_toggle" value="1" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'shipping' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> /> <?php _e( 'Yes', 'woocommerce' ); ?>
    </label>
    <label class="woocommerce-form__label woocommerce-form__label-for-radio radio" style="margin-left:5%;">
        <input id="ship-to-different-address-radio-no" class="woocommerce-form__input woocommerce-form__input-radio input-radio" type="radio" name="ship_to_different_address_radio_toggle" value="0" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'billing' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> /> <?php _e( 'No', 'woocommerce' ); ?>
    </label>
    <span id="ship-to-different-address"><input id="ship-to-different-address-checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'shipping' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> type="checkbox" name="ship_to_different_address" value="1" style="opacity:0;" /></span>
</h3>
Disgusted Dingo

Jawaban yang mirip dengan “Ubah kotak centang pengiriman ke tombol radio”

Pertanyaan yang mirip dengan “Ubah kotak centang pengiriman ke tombol radio”

Lebih banyak jawaban terkait untuk “Ubah kotak centang pengiriman ke tombol radio” di HTML

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya