Score:0

The Quantity field increments in decimals instead of whole numbers

mn flag

Default installation of Commerce 2.x. The qty field for a product, when you click the up arrow to increase the quantity it goes from 1 to 1.01. I want it to go from 1 to 2 to 3, etc.

Ivaylo Tsandev avatar
us flag
Which Drupal version do you use?
Ivaylo Tsandev avatar
us flag
Please check what is the widget type in `/admin/commerce/config/order-item-types/default/edit/form-display` - there is an option to allow or disallow the decimal values for quantity. It should be of type 'Quantity' and 'Allow decimal quantities' checkbox should be unchecked. Beware though because this would be applied to all items from the given type and it might not be what you need.
bobthebuilder avatar
mn flag
I'm using Drupal 9.5.9 and Commerce 8.x-2.36. The quantity field in Form Display already has "Allow decimal quantities" unchecked. A bug maybe?
Ivaylo Tsandev avatar
us flag
It doesn't seem likely. There is a test case for this, so it would have failed if it was a bug. But regardless, I tested plain Drupal installation with the exact same versions and it worked as expected. When the checkbox is checked, the items are increasing with a smaller step (as per the configuration) and when I uncheck it, the step is 1. Please check without any additional modules installed. Also, if there are any custom modules, make sure they are not altering this behavior for some reason. Maybe try a fresh installation, enable only the Commerce and the Commerce Checkout and test again.
Score:0
sa flag
  1. Navigate to: Administration >> Commerce >> Configuration >> Default >> Manage Form display

  2. Under Default tab, set Quantity field to Quantity widget.

  3. Under Add to cart tab, set Quantity field to Quantity widget.

Save and clear cache.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.