diff --git a/app/code/Magento/CatalogInventory/Block/Plugin/ProductView.php b/app/code/Magento/CatalogInventory/Block/Plugin/ProductView.php index 50a79f86c736b84daf6a7cc4cc15bf3ade57dab7..ed66e16c348d8fd1b4f934545a791447246c5cf3 100644 --- a/app/code/Magento/CatalogInventory/Block/Plugin/ProductView.php +++ b/app/code/Magento/CatalogInventory/Block/Plugin/ProductView.php @@ -38,7 +38,7 @@ class ProductView ); $params = []; - $params['minAllowed'] = max((float)$stockItem->getQtyMinAllowed(), 1); + $params['minAllowed'] = (float)$stockItem->getMinSaleQty(); if ($stockItem->getQtyMaxAllowed()) { $params['maxAllowed'] = $stockItem->getQtyMaxAllowed(); } diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php index 601198249ed7294f87b262cd4ed4d7ad6b77af8c..adbd6f356dfb03261cac48d8fe7ffc642a19d9f7 100644 --- a/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php +++ b/app/code/Magento/CatalogInventory/Test/Unit/Block/Plugin/ProductViewTest.php @@ -28,7 +28,7 @@ class ProductViewTest extends \PHPUnit_Framework_TestCase $this->stockItem = $this->getMockBuilder(\Magento\CatalogInventory\Model\Stock\Item::class) ->disableOriginalConstructor() - ->setMethods(['getQtyMinAllowed', 'getQtyMaxAllowed', 'getQtyIncrements']) + ->setMethods(['getMinSaleQty', 'getQtyMaxAllowed', 'getQtyIncrements']) ->getMock(); $this->stockRegistry = $this->getMockBuilder(\Magento\CatalogInventory\Api\StockRegistryInterface::class) @@ -47,7 +47,7 @@ class ProductViewTest extends \PHPUnit_Framework_TestCase $result = [ 'validate-item-quantity' => [ - 'minAllowed' => 2, + 'minAllowed' => 0.5, 'maxAllowed' => 5, 'qtyIncrements' => 3 ] @@ -73,7 +73,7 @@ class ProductViewTest extends \PHPUnit_Framework_TestCase ->method('getStockItem') ->with('productId', 'websiteId') ->willReturn($this->stockItem); - $this->stockItem->expects($this->once())->method('getQtyMinAllowed')->willReturn(2); + $this->stockItem->expects($this->once())->method('getMinSaleQty')->willReturn(0.5); $this->stockItem->expects($this->any())->method('getQtyMaxAllowed')->willReturn(5); $this->stockItem->expects($this->any())->method('getQtyIncrements')->willReturn(3); diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml index 64e0d2ec59d105f2e312a1e24a5b5ab864b8eec7..0df01ccf53deb20c8b073b93d45c2ee6300cb890 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml @@ -179,7 +179,6 @@ <item name="dataScope" xsi:type="string">min_sale_qty</item> <item name="validation" xsi:type="array"> <item name="validate-number" xsi:type="boolean">true</item> - <item name="validate-digits" xsi:type="boolean">true</item> </item> <item name="sortOrder" xsi:type="string">0</item> <item name="value" xsi:type="object">Magento\CatalogInventory\Model\Source\StockConfiguration</item> diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index 236c716f572d91e4bd4b88366414480567ccabc0..d92ddfad5bbc91829144ce3892a2df583ec73c11 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -358,11 +358,10 @@ class Cart extends DataObject implements CartInterface if ($productId) { $stockItem = $this->stockRegistry->getStockItem($productId, $product->getStore()->getWebsiteId()); $minimumQty = $stockItem->getMinSaleQty(); - //If product was not found in cart and there is set minimal qty for it + //If product quantity is not specified in request and there is set minimal qty for it if ($minimumQty && $minimumQty > 0 && !$request->getQty() - && !$this->getQuote()->hasProductId($productId) ) { $request->setQty($minimumQty); }