Establecer un pedido mínimo en WooCommerce

    Modifica el valor de $minimum_amount y pon la cantidad deseada

    <?php
    
    add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
    function required_min_cart_subtotal_amount() {
    	
    	if ( WC()->cart->get_cart_contents_count() == 0 ) {
            return;
    	}
    
        // HERE Set minimum cart total amount
        $minimum_amount = 10;
    
        // Total (before taxes and shipping charges)
        $cart_subtotal = WC()->cart->subtotal;
    
        // Add an error notice is cart total is less than the minimum required
        if( $cart_subtotal < $minimum_amount  ) {
            // Display an error message
            wc_add_notice( '<strong>' . sprintf( __("El importe mínimo para poder hacer el pedido es de %s."), wc_price($minimum_amount) ) . '<strong>', 'error' );
    		remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
    
        }
    }