Max Quantity Order

Hello,

Is there any way to put a maximum order for all the products in my store? For example i dont want the customer to buy more than 10 products, i know that i can put the max for every product but i want to put the same maximum for all my products.

Actually the customer can put as quantity as he wants to buy but for example if he wants 50 and i have 45 automatically 45 products are put in the customer cart exposing this way my stock, i wont a possibility: 1. if he wants to buy 50 and i have in stock 45 to show the message there is not enough stock and not to put in his cart 45 or if this is not possible to put a maximum quantity for buying.

I will appreciate any suggestion,

Thanks in advance.

Every product description has

Minimum order quantity:
Maximum order quantity:

I have my product page done like this

https://forum.cs-cart.com/topic/51105-in-stock/?fromsearch=1

if got less then 100 product got in stock written, if 100+ then actual amount printed

Hello,

Is there any way to put a maximum order for all the products in my store? For example i dont want the customer to buy more than 10 products, i know that i can put the max for every product but i want to put the same maximum for all my products.

Actually the customer can put as quantity as he wants to buy but for example if he wants 50 and i have 45 automatically 45 products are put in the customer cart exposing this way my stock, i wont a possibility: 1. if he wants to buy 50 and i have in stock 45 to show the message there is not enough stock and not to put in his cart 45 or if this is not possible to put a maximum quantity for buying.

I will appreciate any suggestion,

Thanks in advance.

Unfortunately there is no ability to set maximum amount of items for the whole order.

Unfortunately there is no ability to set maximum amount of items for the whole order.

I understand, but is it possible that if the customer wants to buy a product with quantity 30 and that product has quantity 25 to not add in cart that produtct with quantity 25 (as it happens now) but show there is not enough stock??

Unfortunately, no

Unfortunately, no

Is there any way to set a max order amount as it is for min order amount?

- app/controllers/frontend/checkout.php

- app/functions/fn.cart.php

In this files you can find conditions for minimum order amount. Search by min_order_amount. Use it as example

You can use the 'check_add_to_cart_pre' hook and have your hook function be something like

define('MY_MAX_ITEMS', 30);
fn_my_changes_check_add_to_cart_pre(&$cart, &$product, $product_id, &$result) {
  $to_add = $product['amount'];
  $max_quantity = MY_MAX_ITEMS;
  if( !empty($cart['products']) ) {
    foreach($cart['products'] as $cid => $p) {
    $cur_quantity += $p['amount'];
    }
  }
  if( ($cur_quantity + $to_add) > $max_quantity) {
  $result = false;
  fn_set_notification('W', __("warning"), "Max items ($max_quantity) in cart exceeded.  Please complete checkout before ordering more items", 'K');
  }
}