diff --git a/controllers/productControllers.js b/controllers/productControllers.js index 041c4ee..36bc930 100644 --- a/controllers/productControllers.js +++ b/controllers/productControllers.js @@ -106,7 +106,10 @@ exports.searchProducts = async (req, res) => { try { const { productName } = req.body; - const products = await Product.find({ name: { $regex: new RegExp(productName, 'i') } }); + const products = await Product.find({ + name: { $regex: new RegExp(productName, 'i') }, + isActive: true + }); res.json({products}); } catch (error) {