Skip to content

Instantly share code, notes, and snippets.

@nairnwebdesign
Forked from woogist/functions.php
Last active December 31, 2015 16:19
Show Gist options
  • Save nairnwebdesign/8012999 to your computer and use it in GitHub Desktop.
Save nairnwebdesign/8012999 to your computer and use it in GitHub Desktop.
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
global $woocommerce;
$minimum = 50;
if ( $woocommerce->cart->get_cart_total() < $minimum ) {
$woocommerce->add_error( sprintf( 'You must have an order with a minimum of %s to place your order.' , $minimum ) );
}
}
@nairnwebdesign
Copy link
Author

Removed extraneous semicolon from line 6, and changed minimum to 50 in line with the WooCommerce documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment