Author Topic: Minimum quantity in checkout  (Read 345 times)

Offline Ruddog

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Minimum quantity in checkout
« on: March 31, 2017, 06:42:18 PM »
Hi there,

I've created a site that sells wine and I am trying to setup a function so that a customer can only check out with a minimum quantity of product in the cart. For example: I need a minimum of 6 bottles/product to be in the cart before a customer can check out.

On each product you can set a minimum quantity but that does not help as i need it to be the total out of all the wines/product selected.

Any idea of how to do this.

Offline maxter

  • Newbie
  • *
  • Posts: 43
  • Karma: +14/-0
    • View Profile
Re: Minimum quantity in checkout
« Reply #1 on: April 02, 2017, 07:07:56 PM »
I do not think this is possible exactly as you explain.
You can set minimum total money amount for the payment method, but not sure that will help you.

What you need will require some small coding.
Not knowing your technical level, I will give you an idea:

In this file:
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/cart.php

After this line 254:
Code: [Select]
$cart_products = $this->cart->getProducts();

You can add a check for quantity with something like this:
Code: [Select]
if (count($cart_products) < 6) {
   $error_msg[] = "Please add more products ......";
}

Offline Ruddog

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Minimum quantity in checkout
« Reply #2 on: April 06, 2017, 02:04:50 PM »
Aprreciate your help on this. I dont have any coding skill to figure this out.
What i can tell you is once i put the code in the cart.php file and upload it, is that is does give the error message but it does not prevent a checkout. Once you add 6 or more to the cart the error message still aprrears and checkout is still the same as when it had less that a 6 count.

$cart_products = $this->cart->getProducts();

         if (count($cart_products) < 6) {
         $error_msg[] = "Please note a minimum of 6 bottles is required ......";
         }

 

application and website monitoring