I have certain products, which customers can buy only one.

So whether needs to remove Qty box for that products only or can be managed from settings?

  • You can make attribute to add condition for limit in qty box box or hide qty box – Kul Jan 17 '17 at 9:26

There is a config in Admin: Log in to Admin > PRODUCTS > Catalog > choose a Product > Advanced Inventory > Maximum Qty Allowed in Shopping Cart > set to 1.

enter image description here

Overwrite as below



if ($block->shouldRenderQuantity())


if ($block->shouldRenderQuantity() && ($_product->getExtensionAttributes()->getStockItem()->getMaxSaleQty() != 1)):

U need to add

  • Not able to get value in magento\vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml – Ankit Shah Jan 17 '17 at 9:49
  • Okay! I will check again. – Khoa TruongDinh Jan 17 '17 at 9:52
  • Able to get $_product->getStockItem($_product->getId()) still max_sale_qty missing – Ankit Shah Jan 17 '17 at 9:58
  • Should try: $_product->getExtensionAttributes()->getStockItem()->getMaxSaleQty() – Khoa TruongDinh Jan 17 '17 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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