Ich versuche, für alle Versandmethoden einen minimalen Subtotal für alle Versandmethoden zu setzen. Leider funktioniert es nicht, sondern nimmt den Mindestbestellwert mit der lokalen Abholung der Versandmethode nicht an. Sehen Sie, was falsch ist?
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart', 'wc_minimum_order_amount' );
/**
* Minimum order subtotal amount for checkout (excl shipping and taxes)
*/
function wc_minimum_order_amount() {
$minimum = 75; // cart->get_subtotal(); // Cart subtotal excl. shipping and taxes
$chosen_methods = (array) WC()->session->get( 'chosen_shipping_methods' ); // Chosen shipping method rate Ids (array)
// Only when a shipping method has been chosen
if ( ! empty($chosen_methods) ) {
$chosen_method = explode(':', reset($chosen_methods)); // Get the chosen shipping method Id (array)
$chosen_method_id = reset($chosen_method); // Get the chosen shipping method Id
}
// If "Local pickup" shipping method is chosen, exit (no minimun is required)
if ( isset($chosen_method_id) && $chosen_method_id === $shipping_method_id ) {
return; // exit
}
if ( $subtotal < $minimum ) {
$message = sprintf(
esc_html__('Your current order subtotal is %s. To place your order, you must have a minimum amount of %s (excl. shipping and VAT).', 'woocommerce'),
wc_price( $subtotal ),
wc_price( $minimum )
);
if( is_cart() ) {
wc_print_notice( $message, 'error' );
} else {
wc_add_notice( $message, 'error' );
}
}
}
Ich versuche, für alle Versandmethoden einen minimalen Subtotal für alle Versandmethoden zu setzen. Leider funktioniert es nicht, sondern nimmt den Mindestbestellwert mit der lokalen Abholung der Versandmethode nicht an. Sehen Sie, was falsch ist?[code]add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); add_action( 'woocommerce_before_cart', 'wc_minimum_order_amount' );
/** * Minimum order subtotal amount for checkout (excl shipping and taxes) */ function wc_minimum_order_amount() { $minimum = 75; // cart->get_subtotal(); // Cart subtotal excl. shipping and taxes $chosen_methods = (array) WC()->session->get( 'chosen_shipping_methods' ); // Chosen shipping method rate Ids (array)
// Only when a shipping method has been chosen if ( ! empty($chosen_methods) ) { $chosen_method = explode(':', reset($chosen_methods)); // Get the chosen shipping method Id (array) $chosen_method_id = reset($chosen_method); // Get the chosen shipping method Id }
// If "Local pickup" shipping method is chosen, exit (no minimun is required) if ( isset($chosen_method_id) && $chosen_method_id === $shipping_method_id ) { return; // exit }
if ( $subtotal < $minimum ) { $message = sprintf( esc_html__('Your current order subtotal is %s. To place your order, you must have a minimum amount of %s (excl. shipping and VAT).', 'woocommerce'), wc_price( $subtotal ), wc_price( $minimum ) );
Unsere ASP.NET -App verkauft nur digitale Waren und benötigt nicht das Kontrollkästchen Versand zur Abrechnungsadresse . Verwenden des Codebeispiels aus der PayPal Checkout -Dokumentation habe ich...
Ich versuche, das lokale Ollama 2-Modell, das Port 11434 auf meinem lokalen Computer verwendet, mit meinem Docker-Container zu verbinden, auf dem Linux Ubuntu 22.04 ausgeführt wird. Ich kann...
Ich verwende die neueste Version von React-Native-Webview:13.12.5 in meiner React Native-App. Ich habe die Sicherheitsprobleme im Zusammenhang mit WebViews, die den Zugriff auf lokale Ressourcen für...