September 9, 2015 at 8:52 am
We’ve been using the Virtue Theme for over a year, and to set minimum orders I’ve been inserting the code below into my Functions.PHP file after each update of the theme. When I tried to insert it today (I forgot to re-insert it after the last update or two) it gave me an error on line 116 of the functions.php file. What Do I need to change to get the minimum orders to work again? Is there an easier way to do this?
Thanks, Stacey
<?php
add_action( ‘woocommerce_checkout_process’, ‘wc_minimum_order_amount’ );
add_action( ‘woocommerce_before_cart’ , ‘wc_minimum_order_amount’ );
function wc_minimum_order_amount() {
// Set this variable to specify a minimum order value
$minimum = 110;
if ( WC()->cart->total < $minimum ) {
if( is_cart() ) {
wc_print_notice(
sprintf( ‘You must have an order with a minimum of %s (which includes a $10 delivery fee on orders under $150) to place your order, your current order total is %s.’ ,
woocommerce_price( $minimum ),
woocommerce_price( WC()->cart->total )
), ‘error’
);
} else {
wc_add_notice(
sprintf( ‘You must have an order with a minimum of %s (which includes a $10 delivery fee on orders under $150) to place your order, your current order total is %s.’ ,
woocommerce_price( $minimum ),
woocommerce_price( WC()->cart->total )
), ‘error’
);
}
}