Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* @Title: WooCommerce - Set minimum amount for delivery of an order
* @Author: Mina Pansuriya
* @Blog URL:
add_action( 'woocommerce_check_cart_items', 'pbs_cart_check_for_min_order_amount', 99, 1 );
function pbs_cart_check_for_min_order_amount( ) {
global $woocommerce;
// Only check for Cart or Checkout pages
if( is_cart() || is_checkout() ) {
$min_order_amount = 200;
$orderTotal = $woocommerce->cart->total;
if( $orderTotal <= $min_order_amount ) {
// Display our error message
wc_add_notice( sprintf( '<strong>A Minimum of %s %s is required before checking out.</strong>'
.'<br />Current cart\'s total: %s %s',
get_option( 'woocommerce_currency'),
get_option( 'woocommerce_currency') ),
'error' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.