Skip to content

Instantly share code, notes, and snippets.

@wooexperte
Last active November 14, 2023 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wooexperte/8ea21ab51c04d70e7e15de61b532c90a to your computer and use it in GitHub Desktop.
Save wooexperte/8ea21ab51c04d70e7e15de61b532c90a to your computer and use it in GitHub Desktop.
WooCommerce - Mindestbestellwert
/*
* WooCommerce - Mindestbestellwert
* https://wooexperte.de/snippet/woocommerce-mindestbestellwert/
*/
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
$minimum = 100; // Hier bitte den Mindestbestellwert eingeben
if ( WC()->cart->subtotal < $minimum ) { // "subtotal" bedeutet Zwischensumme ohne Versand. Für Mindestbesellwert mit Versandkosten bitte "total" eintragen
if( is_cart() ) {
wc_print_notice(
sprintf( 'Der Mindestbestellwert beträgt %s pro Bestellung. Der aktuelle Bestellwert beträgt %s.' , // Text anpassen Warenkorb
wc_price( $minimum ),
wc_price( WC()->cart->subtotal )// "subtotal" oder "total" anpassen
), 'error'
);
} else {
wc_add_notice(
sprintf( 'Der Mindestbestellwert beträgt %s pro Bestellung. Der aktuelle Bestellwert beträgt %s.' , // Text anpassen Kasse
wc_price( $minimum ),
wc_price( WC()->cart->subtotal )"subtotal" oder "total" anpassen
), 'error'
);
}
}
}
@AdemKa61
Copy link

Is this snippet recently ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment