/* Prevent checkout while an order amount is lower than a certain value */
add_action( 'woocommerce_check_cart_items', 'required_min_cart_subtotal_amount' );
function required_min_cart_subtotal_amount() {
if( is_cart() || is_checkout() ) {
// HERE Set minimum cart total amount
$min_total = 300;
$total = WC()->cart->subtotal;
if( $total <= $min_total ) {
// Display an error message
wc_add_notice( '' . sprintf( __("אנחנו מצטערים. ניתן להזמין מוצרים מהחנות רק בסכום כולל של %s ומעלה. ניתן להוסיף לעגלה מוצרים נוספים לפני המעבר לתשלום."), wc_price($min_total) ) . '', 'error' );
}
}
}
דלג לתוכן