How can I add the quantity not available error message to the quantity that can be added to the cart instead?

enter image description here

Result I expect

"The requested qty is non available, there are XXX qty available"

1 Answer 1


You can override this class: vendor/magento/module-inventory-sales/Model/IsProductSalableForRequestedQtyCondition/IsSalableWithReservationsCondition.php:95

'message' => __('The requested qty is not available'.$qtyLeftInStock) and add this with message like above qtyLeftInStock

Result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.