“Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld” Code-Antworten

Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld

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

Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld

<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

Ähnliche Antworten wie “Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld”

Fragen ähnlich wie “Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld”

Weitere verwandte Antworten zu “Ändern Sie das Kontrollkästchen des Versands in das Optionsfeld” auf HTML

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen