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.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
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
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.
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.