如果您管理使用以下语言构建的在线商店,那么这篇文章很有用 WooCommerce 并且您想知道如何设置最低订单金额 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'
);
}
}
}
这里也是设置消息的地方,提示买家没有总金额未达到下单最低限额的商品。
- 如何自动删除产品图片 WooCommerce,与产品一起
- 固定 wc-ajax = get_refreshed_fragments 高 CPU 用法(禁用 AJAX 购物车片段)
- 如何快速删除所有订单(Orders) WooCommerce [SQL提示]
- 如何取消选中默认值 “Ship to different address” 从 Woocommerce 结帐页面
至 WooCommerce 一些在线支付模块提供自动支持设置下订单的限额。
此功能适用于以低价销售产品,无法支付加工和运输成本的在线商店。