0 0
Read Time:27 Second
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount() {

    // HERE Set minimum cart total amount
    $minimum_amount = 250;

    // Total (before taxes and shipping charges)
    $cart_subtotal = WC()->cart->subtotal;

    // Add an error notice is cart total is less than the minimum required
    if( $cart_subtotal < $minimum_amount  ) {
        // Display an error message
        wc_add_notice( '<strong>' . sprintf( __("A minimum total purchase amount of %s is required to checkout."), wc_price($minimum_amount) ) . '</strong>', 'error' );
    }
}
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %