Against a product in admin, if you go to Advanced Inventory, there's a Yes/No dropdown for Qty Uses Decimals. I would like to know how to update this field via the API, since I need this enabled, and I push into Magento 2 via the API.

I've tried searching in endpoint /V1/products/attributes but can't seem to find it.

1 Answer 1


You are looking in wrong place, stock is not an attribute on product but an object related with a product and therefore has its own data table and logic. The table is cataloginventory_stock_item and column is_qty_decimal.

Webapi for stock update is magento/module-catalog-inventory/etc/webapi.xml and related interface magento/module-catalog-inventory/Api/StockRegistryInterface.php

<route url="/V1/products/:productSku/stockItems/:itemId" method="PUT">
    <service class="Magento\CatalogInventory\Api\StockRegistryInterface`" method="updateStockItemBySku"/>
        <resource ref="Magento_CatalogInventory::cataloginventory"/>

Good luck! :)

  • You know why the default is decimal? I mean, wouldn't most people be selling a product per product? Dec 14, 2018 at 22:00
  • Well, MOST is still less than ALL and therefore if some items can be sold in parts then it would require very intrusive modification of the data type. Decimal covers all possible scenarios of how user might want to treat products in his ecommerce. Dec 16, 2018 at 7:39
  • Any reason is_qty_decimal exists? Considering.. it's still a decimal either way? Dec 17, 2018 at 19:20
  • is_qty_decimal is more like a semantic description of qty than its data type. Data type is always decimal but in case that qty for a given product can hold only integer values then is_qty_decimal flag will tell you about it. Imagine situation where you want to know about product, let's say: can i sell 1.5 of that? You can check that flag to know that. Plus I think that flag has impact on frontend behaviour of adding products to cart and stuff like that (I did not check the last assumption). Dec 18, 2018 at 6:08

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.