Use input of type "number" for quantity selection

Created on 19 October 2023, about 1 year ago
Updated 25 October 2023, about 1 year ago

Problem/Motivation

The form to quickly add a product to the cart, currently displays an input of type "text" for quantity selection. Using an input of type "number" seems to bee more suitable. Additionally most browsers display controls for inputy of type "number" to help the user setting the quantity.

Feature request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇩🇪Germany sboetticher

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sboetticher
  • 🇪🇪Estonia drugan

    The reason why it is a textfield is quantity might be integer as well as decimal type of a number too:

    1, 123, 0.1, 1.123, 1235.6789, etc ...
    

    So to implement a number field type here we also need to dynamically set #step property of the field based on its settings on an order item type. Which we don't know in advance before a customer has selected variation (type) in the list.

    To grasp the complexity of the task you can install commerce_xquantity module and try to play with different quantity number types. It is quite a legal case when some Drupal Commerce site sell its products measured by kilo+grams or liter+milliliters or any other similar unit.

    In my mind this game is not worth the candle. Much simpler would be to set a placeholder on the field giving possible value hint for a customer.

  • 🇩🇪Germany sboetticher

    I understand and agree. My case is a simple one without decimal etc.
    Thanks for the explanation.

  • Status changed to Closed: works as designed about 1 year ago
Production build 0.71.5 2024