Skip to content

Commit

Permalink
Update cart.php
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Nov 13, 2024
1 parent 2939925 commit b9744cb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions upload/catalog/controller/api/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ public function addProduct(): array {
}
}

// Stock
$product_total = 0;

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

foreach ($products as $product_2) {
if ($product_2['product_id'] == $product_info['product_id']) {
$product_total += $product_2['quantity'];
}
}

if (!$this->config->get('config_stock_checkout') && (!$product_info['quantity'] || ($product_info['quantity'] < $product_total))) {
$output['error']['warning'] = $this->language->get('error_stock');
}

// Validate subscription plan
$subscriptions = $this->model_catalog_product->getSubscriptions($product_id);

Expand Down

0 comments on commit b9744cb

Please sign in to comment.