有用的文章,如果您管理使用WoCommerce构建的在线商店,并且想知道如何在WooCommerce中设置最低订单。在在线商店的默认设置中 self-hosted,结帐选项不存在。因此,确定订单的最低金额将通过另一种方法完成。
与物理商店相比,一个在线商店通常会施加新规则,这取决于产品销售的客户,其价值以及付款和交付方法。
如果我们输入并购买10美分的产品,在物理商店中没有问题,那么在在线商店中,情况有所不同。客户的任何订单都涉及商店的一些费用。从简单的处理订单到包装,运输,所有这些操作都需要时间。
当销售优惠包含非常便宜的产品时,最好为每个订单付出最低量。例如,如果篮子中的总产品未达到10欧元,则无法完成订单。
如何在WooCommerce中设置最低订单金额
最简单的方法是在 functions.php 您可以通过其中设置订单的最低金额 WooCommerce。
打开文件 functions.php 主题主题(最好是儿童主题),并添加以下代码:
// Set Minimum Order Amount in WooCommerce
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
$minimum = 10; // Set this variable to specify a minimum order value
if ( WC()->cart->total < $minimum ) {
if( is_cart() ) {
wc_print_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
} else {
wc_add_notice(
sprintf( 'Your current order total is %s — you must have an order with a minimum of %s to place your order' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
), 'error'
);
}
}
}
另外,从这里设置了一个消息,该消息警告他没有产品总金额未达到下订单的最低限制的产品。

- 您如何使用产品自动删除产品图像
- 修复wc-ajax = get_refreshed_fragments高CPU用法(禁用Ajax推车片段)
- 如何快速删除WooCommerce中的所有命令(订单)[SQL TIPS]
- cum debifam隐式“船到不同地址” din pagina de Checkout
对于WooCommerce,一些在线支付模块提供了自动支持,以设置可以从中订购订单的限额。
此功能对于销售低价产品的在线商店很有用,这些商店无法支付处理和运输成本。