Welcart 購入した商品点数で割引を行う

2017.11.27

Welcartでは所謂業務パックでは異なる商品を複数点購入した場合には不都合が多いです。
また、業務パックと異なり商品点数をパーセンテージではなく単価で割引を設定したいという場合に有効です。

//商品点数で割引
add_filter('usces_order_discount', 'sku_order_discount', 10, 3);
function sku_order_discount($discount, $carts, $entries){
	global $usces;
	$total = $usces->get_total_quantity( $cart );
	if ( ($total >= 2) && ($total < 3) ) {
	$discount = -5000;
	}
	if ( ($total >= 3) && ($total <= 4) ) {
	$discount = -7500;
	}
	return $discount;
}

functions.phpに上記を追加することで実現可能です。
この場合2個以上買うと5,000円引き、3個以上買うと7500円引きが可能です。

特定SKUのみに設定する場合はSKUでの切り分けを行えばバッチリですね。