For a better experience please change your browser to CHROME, FIREFOX, OPERA or Internet Explorer.
List your Store
WordPress Code for Setting a minimum order amount for checkout

WordPress Code for Setting a minimum order amount for checkout

Set a minimum order amount for checkout

 

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 = 70;  //Cart Amount should have minimum amount of 70 then only it proceeds to checkout

$subtotas =WC()->cart->subtotal;
$current_shipping_cost = WC()->cart->get_cart_shipping_total();

$subss =$totas – $current_shipping_cost;

if ( $subtotas < $minimum ) {

if( is_cart() ) {

wc_print_notice(
sprintf( ‘Your current order total is %s — you must have an order with a minimum of %s to place your order ‘ ,
wc_price( $subtotas ),
wc_price( $minimum )
), ‘error’
);

}
else{
wc_add_notice(
sprintf( ‘Your current order total is %s — you must have an order with a minimum of %s to place your order’ ,
wc_price( $subtotas ),
wc_price( $minimum )
), ‘error’
);
}
}

}

leave your comment


Your email address will not be published. Required fields are marked *

Top
0