LoginSignup
0
0

More than 5 years have passed since last update.

Welcartで購入点数で割引をする

Posted at

うったて

業務パック割引って同じ商品を2個以上とか、しかもパーセンテージで割引するの使いにくいよね。ってことで、買った商品点数で割引を出すほうがいいやという話です。コードには無駄があるかもしれませんが、一応概念の共有ということでお許し下さい。

やり方

functions.php

add_filter('usces_order_discount', 'item_count_order_discount', 10, 3);
function item_count_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;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0