Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Minimum order quantity per product


Recommended Posts

Try this




It should do what you want - you'll need to run an sql query to install a new field in the products table then edit


admin/categories.php (and language file)

shopping_cart.php ( ditto )




This'll give you a min quantity field in the admin page for each product (defaults to 1 for existing products). Product page will have a text box next to the buy button which defaults to whatever min quantity you have inserted.

If customers decide to ignore that and try to add a smaller quantity there's a check in shopping_cart which flags this up to them and hides the checkout buttons.

If they then try to go through checkout by manually entering the url for checkout_shipping, conf, or payment then an edit in application_top will bounce them back to shopping_cart.


Any problems leave a comment on http://www.oscommerce.com/forums/topic/393051-contribution-min-order-quantity-per-product-for-23x/

Link to comment
Share on other sites

Yes , great , i will try .

I want to ask you something .

I am using a sort of one page checkout system .

If a customer add in cart 2 products and minim quantity is 3 , is there any flag that he tells him he not reached the minim order quantity or it needs to add more products in order to checkout ?

Link to comment
Share on other sites

Errr - probably not - also - the code will not limit the entire number of products in your cart it is 'per product' - so if you have set :


Product X - min quantity 5

Product Y - min quantity 10


Then the customer must have at least those amounts of each individual product in their cart.

If you want to have a set minimum of All products in the cart you'll need a different code.


The code supplied may work with a one page checkout if the filename is something like 'checkout.php' - so long as the string 'checkout' is int he filename then the code added to the foot of application _top will send them to shopping_cart.php where the product(s) will be flagged up - however if your one page checkout has the shopping cart contained within it (as some do) then the code will not work as supplied

Link to comment
Share on other sites

If all you need is to count the total, use


if ($cart->count_contents() < 3) tep_redirect(FILENAME_SHOPPING_CART, 'error_message=not+enough');


Change the 3 to set a different minimum quantity.


@@Bob Terveuren - here is the exact reason why it's not ideal to waste ones time making something without getting more details from the person doing the asking. Well done on making it though, and uplifting to the addons area, as it will no doubt come in useful for lots of people in the future. :thumbsup:

Link to comment
Share on other sites

I have a customized checkout page , all checkout process is taking place on shopping_cart.php file , including address , shipping method , payment method .

My site is www.ecig-vapo.com .


Before i try to install this great extension i want to make sure that I have a chance of getting it work , since my shop is not default one

Link to comment
Share on other sites

Ahh - the only certainty in life is death - but here's an idea.......


backup all the files involved & the database (ideally have a copy of the store running on a test server someplace so you can experiment).


Grab the code from the package and install the code edits as described - you'll need to go search in the files if your store for code that looks similar I'm afraid.


You can omit the bit that goes at the foot of includes/application_top.php that looks like:


Add the foot of the file before the closing ?> add
 if ( true == strpos($_SERVER['REQUEST_URI'],'checkout') ) {


Now when you code the page that relates to your shopping_cart.html page you need to add in the code that changes the product name to add 'You must buy XXX of these to checkout)

Then insert the code that 'hides' the checkout button and change the class name to whatever class your template uses.


//min _quantity csss hide buttons
 .buttonSet, .bt_pp_hide{display:none}

<?php }


If that's a bit of an ask then, like Burt says, pop over to the commercial part of the forum and ask somebody to run it in for you

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...