How can i set minimum order amount for specific country?

To set a minimum order amount for a certain country in the store, the following code snippet helps. In addition, you should add a textual note to inform potential buyers about the minimum order amount in advance.

add_action( 'woocommerce_check_cart_items', 'cw_min_num_products' );
function cw_min_num_products() {
  if( is_cart() || is_checkout() ) {
    global $woocommerce;
                $minimum = 20;
    	$county = array('DE');   
                $cart_tot_order = WC()->cart->total;
    if( $cart_tot_order < $minimum && in_array( WC()->customer->get_shipping_country(), $county )  ) {
          wc_add_notice( sprintf( '<strong>A Minimum order of $%s is required before checking out.</strong>' 
          	. '<br />Current order: $%s.',
          	$minimum,
                $cart_tot_order	),
          'error' );
    }
  }
}
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.