Last active
December 25, 2015 05:29
-
-
Save woogist/6925225 to your computer and use it in GitHub Desktop.
Place in your theme’s functions.php file or custom plugin. Will only allow customers to checkout is their cart total is greater than 50.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); | |
function wc_minimum_order_amount() { | |
global $woocommerce; | |
$minimum = 10; | |
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 ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 6
should look like this
if ( $woocommerce->cart->get_cart_total() < $minimum ) {
The semi-colon should be removed.