在 WooCommerce 中设置最低未折扣订单金额

我正在使用“最低订购量”来要求最低订购量。

如果我有一篮子 50 欧元的商品并且我应用了 10% 的折扣代码,我无法订购我的购物车,因为总计为 45 欧元。

但我想以低于50 欧元的价格使用折扣码订购


jeck猫
浏览 121回答 1
1回答

狐的传说

更新:使用以下重新访问和压缩的代码,该代码使用未折扣的总数:add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );function wc_minimum_order_amount() {&nbsp; &nbsp; // Set this variable to specify a minimum order value&nbsp; &nbsp; $minimum = 50;&nbsp; &nbsp; $total = WC()->cart->total;&nbsp; &nbsp; $discount_total = WC()->cart->get_discount_total(); // updated thanks to 7uc1f3r&nbsp; &nbsp; $maximized_total = $total + $discount_total;&nbsp; &nbsp; if ( $maximized_total < $minimum ) {&nbsp; &nbsp; &nbsp; &nbsp; $notice = sprintf( __('Your current order total is %s — you must have an order with a minimum of %s to place your order '),&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wc_price( $maximized_total ),&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wc_price( $minimum )&nbsp; &nbsp; &nbsp; &nbsp; );&nbsp; &nbsp; &nbsp; &nbsp; if( is_cart() ) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wc_print_notice( $notice , 'error' );&nbsp; &nbsp; &nbsp; &nbsp; } else {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wc_add_notice( $notice , 'error' );&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}代码进入您的活动子主题(或活动主题)的 functions.php 文件。测试和工作。
打开App,查看更多内容
随时随地看视频慕课网APP