https://forum.opencart.com/viewtopic.php?t=122555

This is a universal change only (i.e., not customizable for individual products), but for Opencart v2.0.x.x this works:

Starting at line 273 in /catalog/control/product/product.php:

Find

if ($product_info[‘quantity’] <= 0) {
$data[‘stock’] = $product_info[‘stock_status’];
} elseif ($this->config->get(‘config_stock_display’)) {
$data[‘stock’] = $product_info[‘quantity’];
} else {
$data[‘stock’] = $this->language->get(‘text_instock’);
}

Replace with

if ($product_info[‘quantity’] <= 0) {
$data[‘stock’] = $product_info[‘stock_status’];
} elseif ($this->config->get(‘config_stock_display’) && $product_info[‘quantity’] <= 5) {
$data[‘stock’] = ‘Only ‘ . $product_info[‘quantity’] . ‘ left in stock’;
} else {
$data[‘stock’] = $this->language->get(‘text_instock’);
}

Change the “5” to whatever minimum number you want.

試看看能不能好了

Views: 18