Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working in Drupal 7 in Ubercart 3, and I am looking for a way to set a minimum on the number of items that a user can have before being able to start the checkout process.

Is there a module out there that handles this need?

share|improve this question

There is Ubercart Product Minimum & Maximum

Adds minimum, maximum and order in multiples limits on products. Checks that the quantity selected matches the limits during both Add To Cart and Checkout actions. Quantity checks are disabled when product is added to the cart as part of a product kit.

If you want to do it with code this is one way to do that.

You can make use of hook_add_to_cart to get the product add event.

To get the number of items use uc_cart_get_contents

The ides is

function <modulename>_add_to_cart($nid, $qty, $data) {
  $items = uc_cart_get_contents();
// Display a message if the cart has more than 5 products.
  $item_count = count($items);
  if ($item_count < 5) {
    drupal_set_message('Your cart Should contains more than 5 products to checkout !');
    // drupal_goto to product listing page
  return $result;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.