Skip to content

Commit 1f2aeda

Browse files
committed
Fix qty validation and custom option buy request provider
1 parent 226cbf7 commit 1f2aeda

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/CustomizableOptionsDataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function execute(array $cartItemData): array
4444
}
4545
}
4646

47-
return ['options' => $customizableOptionsData];
47+
return ['options' => $customizableOptions];
4848
}
4949

5050
/**

app/code/Magento/QuoteGraphQl/Model/Cart/BuyRequest/QuantityDataProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ public function execute(array $cartItemData): array
3838
if (!isset($qty)) {
3939
throw new GraphQlInputException(__('Missing key "quantity" in cart item data'));
4040
}
41+
$qty = (float)$qty;
4142

42-
return ['qty' => (float)$qty];
43+
if ($qty <= 0) {
44+
throw new GraphQlInputException(
45+
__('Please enter a number greater than 0 in this field.')
46+
);
47+
}
48+
49+
return ['qty' => $qty];
4350
}
4451
}

0 commit comments

Comments
 (0)