1

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.

3 Answers 3

3

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.

2
  • 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
    Commented Jul 30, 2013 at 20:12
  • I don't see any reasons for this to be harmful. but back uo your table, just in case :).
    – Marius
    Commented Jul 31, 2013 at 6:13
1

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.

2
  • 1
    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
    Commented Jul 29, 2013 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
    Commented Jul 30, 2013 at 3:50
0

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.

2
  • Is it just me or did they remove that feature somewhere along the road till CE 1.9.1? Commented Sep 28, 2015 at 10:55
  • yes this is now removed.
    – Ash Singh
    Commented Nov 23, 2017 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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