"QTY Minimums" addon - satisfy minimum quantities with product options

This addon will allow your customers to satisfy the Minimum Quantity requirement with a combination of product options (size, color, etc.). For instance, when purchasing a t-shirt that has a minimum quantity of 24, they may purchase 20 Smalls and 4 Larges to meet the minimum. Without this addon, the cart would force the customer to purchase 24 of any unique option combination.

When adding < MIN QTY to the cart, the user will see an alert on the product page and in the cart. See screen shots for an example.

The addon requires you to add 2 hooks to /core/fn.cart.php


```php if (isset($current_amount) && $current_amount >= 0 && $current_amount - $amount < 0 && Registry::get(‘settings.General.allow_negative_amount’) != ‘Y’) { ```

Insert this immediately ABOVE that line:

```php fn_set_hook(‘check_amount_in_stock’, $product_id, $amount, $product_options, $cart_id, $is_edp, $original_amount, $min_qty); // [QTY_MINIMUMS ADDON] ```


```php fn_set_notification(‘W’, fn_get_lang_var(‘notice’), str_replace(array(‘[product]’ , ‘[quantity]’), array($product[‘product’] , $min_qty), fn_get_lang_var(‘text_cart_min_qty’)));

if (!defined(‘ORDER_MANAGEMENT’)) { ```

Insert this immediately BELOW that line:

```php fn_set_hook(‘check_amount_in_stock_minimum’, $product_id, $amount, $product_options, $cart_id, $is_edp, $original_amount, $min_qty); // [QTY_MINIMUMS ADDON] ```

This has been tested in CS-Cart 2.1.4 Professional.






*** gIve the man a star***

this is a real benefit to anyone who has options. I know CS is a good Cart but a few litltle things like this in the core code that are improvements to the way options are handled would make it so much better.

I did pay CS for similar to this for the options to be added together for qty discounts a while back 2.12. So now we can have the minimums added together aswell.

This will help me a lot

Thanks Glen


Definitely this one is a good addon, really helpful. Thanks mate :smiley:

Just one req, can you also able to make a addon which hide qty discount from visitors and only those view who have a account, i mean it shows like this

1–4 = $25

5–8 = $22

9–15= Sign-in


As it stands now…CS shows the specified min qty in the add to cart qty box.

so if you set min qty at 10 it auto fills the field with 10. Is there any way to stop this as its not really needed because the message " minimum order qty for this item is 10" appears under the box anyway.


[quote]CS shows the specified min qty in the add to cart qty box.[/quote]

This is on my to-do list.

[quote] can you also able to make a addon which hide qty discount from visitors[/quote]

Sorry, but I only have time to work on addons I need.

Looks good. Simple and well constructed. Should help out a lot of folks whose products have different options. Good job.

yeah thanks a lot :slight_smile:

[quote name=‘sixnin9’]This is on my to-do list.

Sorry, but I only have time to work on addons I need.[/QUOTE]

but don’t you think it is also a good addon ?

Miracles: I guess I don’t really see how that would incent my customers. In any case, you’re hijacking this thread.

not hijacking, just asking…


Thanks for asking. It amazes me how fast people jump on things about “hijacking”. My goodness, this forum is very tense to say the least! Relax people! No one “owns” a thread!!

I would agree the add on is nice and a great idea but I can also clearly see how miracles suggestion would make it more useful to us and probably others. I also can see how it flows with this mod you have created. Maybe it is something that miracles can add later?

Clips…stop Hijacking this thread.


Anyone have this working on 2.2.2? I added in the changes and I don't see this making any difference.

Anyone have any clue how to get this working on 3? I just added it in but also not changes as rmsilver7 mentioned in regards to 2.2.2.

Need it for V 3 my self too, strange how they added the ability to combine product options for qty discounts but didnt carry it through to the minimum required qtys .

Can pay for this addon.


It was working fine in v2.1.x, but required changes + updates for 2.2.x (inconclusive…). Last weekend, I tried it in v3.0.3 and of course didn’t work.

I assume the way to get it to work would be to look at what it is modifying , compare those files to v3 or v2.2, and then search for the similar functions and variables in use.

Although, now we have the headache of trying to get his working in both Ultimate and Multi-Vendor. :shock:

Happy to pay for v3 version too!

I don’t know what goes through the minds of the developers at Simbirsk, and why they don’t include updates to such basic functionality - let alone improve existing features between major versions - it just seems silly!


Features do actually require updating, that were implemented back in May 2008!

“Lest we forget the Quickbooks Add-on…”