We are hiring PHP Web Developers (0-2 exp), Please visit career page for more information.

The following code is used to prevent users to proceed checkout from cart page without filling the shipping calculator and calculate the shipping amount,

You can put the following code in your functions.php file

add_action('wp_head','prevent_proceed_to_checkout');
function prevent_proceed_to_checkout() { 
echo '	<script>
			jQuery(function(){ 	
				jQuery(".woocommerce-cart .wc-proceed-to-checkout a.checkout-button").on("click",function(e){
					var _this = this;
					alert("Please calculate shipping!");
					e.preventDefault();
					jQuery(".shipping-calculator-form .button").on("click",function(){
						jQuery(_this).off();
					});
				 });
			});
		</script>';
}
Require shipping calculator before proceed checkout – WooCommerce
Tagged on: