Skip to content

Commit d32e5b1

Browse files
committed
ACP2E-3256: [GraphQl] [Feature Request] min/max qty allowed in shopping cart for products
1 parent 5bc36ba commit d32e5b1

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

app/code/Magento/CatalogInventoryGraphQl/Model/Resolver/MaxSaleQtyResolver.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogInventoryGraphQl\Model\Resolver;
99

10-
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
1110
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1211
use Magento\Framework\GraphQl\Config\Element\Field;
1312
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -38,12 +37,12 @@ public function __construct(
3837
*/
3938
public function resolve(
4039
Field $field,
41-
ContextInterface $context,
40+
$context,
4241
ResolveInfo $info,
43-
?array $value,
44-
?array $args
42+
?array $value = null,
43+
?array $args = null
4544
) {
4645
$stockItem = $this->stockItemService->getStockItem($value['model']);
47-
return $stockItem ? $stockItem->getMaxSaleQty() : null;
46+
return $stockItem?->getMaxSaleQty();
4847
}
4948
}

app/code/Magento/CatalogInventoryGraphQl/Model/Resolver/MinSaleQtyResolver.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CatalogInventoryGraphQl\Model\Resolver;
99

10-
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
1110
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
1211
use Magento\Framework\GraphQl\Config\Element\Field;
1312
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -38,12 +37,12 @@ public function __construct(
3837
*/
3938
public function resolve(
4039
Field $field,
41-
ContextInterface $context,
40+
$context,
4241
ResolveInfo $info,
43-
?array $value,
44-
?array $args
42+
?array $value = null,
43+
?array $args = null
4544
) {
4645
$stockItem = $this->stockItemService->getStockItem($value['model']);
47-
return $stockItem ? $stockItem->getMinSaleQty() : null;
46+
return $stockItem?->getMinSaleQty();
4847
}
4948
}

app/code/Magento/CatalogInventoryGraphQl/Model/StockItemService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(
4949
* Returns stock item if the product is available
5050
*
5151
* @param Product|null $product
52-
* @return Item
52+
* @return Item|null
5353
*/
5454
public function getStockItem(?Product $product)
5555
{

0 commit comments

Comments
 (0)