I’m planning out a small online-store for a side project which is already running. Therefor I built a simple website with five products and a optional laser engraving for each product. At the moment customers have to order via email.
Now I want to provide a cart and a checkout and already had a look at shopkit.
I looks very promising to me but for me a Volume discount option is crucial.
For example I want to price a product as follows:
qty. 1-4 price= € 30,-
qty. 5-9 price= €28,-
qty. 10- price= €26,-
What I’m searching is a tip/hint how to implement this functionality in my kirby site.
<?php
// some more stuff for other discounts happen above in my function...
// $qty = total items in cart
} else {
foreach(page('shop')->rabatt()->toStructure()->sortBy('qty','desc') as $coupon){
if($qty >= $coupon->qty()->value()){
$rabatt = $coupon->price()->value();
break;
}
}
}
return $rabatt;
}
// the return $rabatt value will then be applied in calculations by the function...
?>
so i have a set structure table in this easy example where as
4 items will give a fixed amount of 10 € discount
5 items 15 €
6 items 20 €
or whatever i set…
Edit: Oh well, you edited your title, so this code is not for shopkit…
This is a problem I haven’t come up with a good solution for yet. I usually set up different variants based on quantity. E.g. 1-pack, 5-pack, and 10-pack are variants of the same product. Then customers can get the quantity discounts if they buy the 5-pack.
It does make things a bit more difficult for inventory though.