mercredi 16 mars 2022

Hide woocommerce notice with checkbox, based on shipping class

Want to hide woocommerce notice with jQuery on checkout page if specific shipping class checkbox is checked. Trying to make with this code but not working for me :(

//Hide Delivery Message in case Express Shipping Checked

add_action( 'woocommerce_checkout_process', 'hide_notice_billing' );
function hide_notice_billing(){
    ?>
        <script>
        jQuery(function($){
           $(document).ready(function() {
    $(document).on("click", "#shipping_method_0_flat_rate-12", function(e) {
       var checked = $(this).find("input:checkbox").is(":checked");
       if (checked) {
           $('.woocommerce-message').hide(300);
       } else {
           $('.woocommerce-message').show(300);
       }
    });
});
        });
    </script>
    <?php
}



Aucun commentaire:

Enregistrer un commentaire