# Magento product quantity uses decimals

I know that there is an option to use decimals for product quantity for every product. But is there an option to change this globally?

I am using Magento CE 1.7.

Many thanks.

In order to change this for the products that are already in your catalog runt this query on your database:

UPDATE cataloginventory_stock_item SET is_qty_decimal = 1;


And rebuild your stock index.
I know...I know ...'don't edit the DB directly'. Well...I do it often because it solves the problems easily, and (I like to think) I know what I'm doing.

For the new added products just set the field Qty Uses Decimals to Yes.

• Thanks for that Marius. I already thought in the same direction but was still looking for the ideal Magento conform solution. However, if it does the job and does no harm ... – Andreas Jul 30 '13 at 20:12
• I don't see any reasons for this to be harmful. but back uo your table, just in case :). – Marius Jul 31 '13 at 6:13

To my knowledge you do not need to specify in configuration whether this feature is enabled or not. By default you can change any quantity to a fractional value.

$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
$stock->setQty(.88);$stock->save();


Works like a charm for me, both programmatically and in the admin panel. No configuration needed. What you may need to do is enable quantity increments or provide a useful UI to the customer purchasing so that they know they can purchase in fractional increments.

• If it is not enabled on the product, the cart/checkout is just cutting off the the decimals for me. I tried it programmatically (as you described it) but I hadn't success with that. Again, it just displays integers. Did you change something in the configuration or settings? – Andreas Jul 29 '13 at 22:57
• I'm updating the answer - but the gist is that the cart/checkout are rounding, which means we'll have to set a config value for CE that is pre-set in EE. – philwinkle Jul 30 '13 at 3:50

To make all products uses decimals in qty, just select all in admin, choose Update Attribute in action dropdown in top right, this will bring all the attributes on one page, now click on Inventory Tab on left hand side, change 'Use Decimal Qty' to yes, Save. All done.

• Is it just me or did they remove that feature somewhere along the road till CE 1.9.1? – Manuel Arwed Schmidt Sep 28 '15 at 10:55
• yes this is now removed. – Ash Singh Nov 23 '17 at 9:59