Skip to content

Instantly share code, notes, and snippets.

@jameskoster
Last active January 19, 2016 14:41
Show Gist options
  • Select an option

  • Save jameskoster/5642209 to your computer and use it in GitHub Desktop.

Select an option

Save jameskoster/5642209 to your computer and use it in GitHub Desktop.
WooCommerce Minimum Order Amount
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
global $woocommerce;
$minimum = 50;
if ( $woocommerce->cart->total() < $minimum ) {
$woocommerce->add_error( sprintf( 'You must have an order with a minimum of %s to place your order.' , $minimum ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment