I want to disable adding a product to cart beyond its stock limit through ajax in opencart 2.x,Now opencart only shows a message on header "Products marked with *** are not available in the desired quantity or not in stock!". But i want products not to be added to cart if more is ordered than what's in stock,now openacart's stuff is time consuming as well as not advance for buyer to make changes again and again,
I tried but not sure where should i make changes ,whether it start in catalog/controller/api/cart.php or in common.js or system/lirary/cart.php ,i try this code-
if ((int)$qty && ((int)$qty > 0)) {
if( ($this->session->data['cart'][$key])==(int)$product['stock']){
}
else{
if (!isset($this->session->data['cart'][$key])) {
$this->session->data['cart'][$key] = (int)$qty;
} else {
$this->session->data['cart'][$key] += (int)$qty;
}
}
}