I woulk like to calculate on Woocommerce shipping cost based on country without clicking "Update button".
I checked posts on forums but it did not work for me: Shipping calculator state field change trigger update in WooCommerce cart
Can someone help with it?
here is code I have right now:
// 1 Disable State
add_filter( 'woocommerce_shipping_calculator_enable_state', '__return_false' );
// 2 Disable City
add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );
// 3 Disable Postcode
add_filter( 'woocommerce_shipping_calculator_enable_postcode', '__return_false' );
add_action('wp_footer', 'cart_country_update_shipping_methods', 50);
function cart_country_update_shipping_methods() {
if ( ! is_cart() ) return; // On cart
?>
<script type='text/javascript'>
jQuery(function($){
$(document.body).on('change', 'select[name="calc_shipping_country"]', function(){
$(this).submit();
});
});
</script>
<?php
}
www.zGruzie.cz -- this web.