-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Preconditions and environment
- magento/product-enterprise-edition 2.4.6-p11
- php 8.1
- magento/extension-b2b 1.5.2-p1
Steps to reproduce
When you have a product in your requisition list that only can be bought by the 10 you get the following error from:
\Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsCorrectQtyCondition::execute:116
Which gives you a nice clear message to the customer on what to do with their requisition list:
You can buy this product only in quantities of %1 at a time.
But when its shown in your customer view and you have for example 51 and you can only buy by the 10 products. you get the following message:
The requested qty is not available
Which does not tell the customer what is wrong and prevent a sale from class:
\Magento\InventoryRequisitionList\Plugin\Model\RequisitionListItem\Validator\StockPlugin::aroundValidate
I used this patch to resolve the issue:
Index: vendor/magento/module-inventory-requisition-list/Plugin/Model/RequisitionListItem/Validator/StockPlugin.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/module-inventory-requisition-list/Plugin/Model/RequisitionListItem/Validator/StockPlugin.php b/vendor/magento/module-inventory-requisition-list/Plugin/Model/RequisitionListItem/Validator/StockPlugin.php
--- a/vendor/magento/module-inventory-requisition-list/Plugin/Model/RequisitionListItem/Validator/StockPlugin.php
+++ b/vendor/magento/module-inventory-requisition-list/Plugin/Model/RequisitionListItem/Validator/StockPlugin.php (date 1754475305174)
@@ -115,7 +115,10 @@
$result = $this->areProductsSalableForRequestedQty->execute([$request], $stockId);
$result = current($result);
if (!$result->isSalable() && !$product->isComposite()) {
- $errors[$subject::ERROR_LOW_QUANTITY] = __('The requested qty is not available');
+ /** @var \Magento\InventorySalesApi\Api\Data\ProductSalabilityErrorInterface $error */
+ foreach ($result->getErrors() as $error) {
+ $errors[$error->getCode()] = __($error->getMessage());
+ };
return $errors;
}
Expected result
I expect to see the message:
You can buy this product only in quantities of %1 at a time.
Actual result
I see the message:
The requested qty is not available. which prevent a sale from going through.
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status