“Zmień pole wyboru wysyłki na przycisk opcji” Kod odpowiedzi

Zmień pole wyboru wysyłki na przycisk opcji

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

Zmień pole wyboru wysyłki na przycisk opcji

<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

Odpowiedzi podobne do “Zmień pole wyboru wysyłki na przycisk opcji”

Pytania podobne do “Zmień pole wyboru wysyłki na przycisk opcji”

Więcej pokrewnych odpowiedzi na “Zmień pole wyboru wysyłki na przycisk opcji” w HTML

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu