If you are using WordPress for your website with WooCommerce for ecommerce you may want to have a minimum order amount for product orders on there. If you want to do that without a plugin you can then add this code to your functions.php file. You may want to backup your WordPress website before you make updates the file on there.
New minimum order amount for WooCommerce
/** * New minimum order amount * * @author WPSnacks.com * @link https://www.wpsnacks.com */ function new_minimum_order_amount() { $minimum = #; if ( WC()->cart->total < $minimum ) { if( is_cart() ) { wc_print_notice( sprintf( 'Your order total is %s — you need an order with a minimum of %s to place your order ' , wc_price( WC()->cart->total ), wc_price( $minimum ) ), 'error' ); } else { wc_add_notice( sprintf( 'Your order total is %s — you need an order with a minimum of %s to place your order' , wc_price( WC()->cart->total ), wc_price( $minimum ) ), 'error' ); } } } add_action( 'woocommerce_checkout_process', 'new_minimum_order_amount' ); add_action( 'woocommerce_before_cart' , 'new_minimum_order_amount' );
Then you can replace the # for the minimum. Now if that works for you it would add a minimum order amount to WooCommerce orders on your WordPress website on there.
Leave a Reply