0
    function add_extra_discount( $cart ) { ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>


<script>
    $(document).ready(function(){
        if($('table.shop_table.shop_table_responsive').find('.cart-discount').length !== 0){
            $('#shipping_method > li').not('#shipping_method > li:first-child').hide();
        }
    });
</script>


<?php }
add_action( 'woocommerce_cart_calculate_fees', 'add_extra_discount' );

This is what my code looks like. But We have to reload to hide the shipping options. Can we do it without reloading the page??

Thanks for the help in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.