Search code examples
shopping-cart

What to do if someone tries to add part of a product to a basket?


If a customer were "silly" (being polite here) enough to try and add, as an example, 4.6 items to their basket, what would you expect to see? or how would you deal with it. Obviously, we only deal with digital quantities (our hacksaw broke last week).

There seems to be a lot of inconsistence across the web.

  • Amazon Rounds down (4.6->4, 1.3->1)
  • FireBox Rounds (4.6->5, 1.3->1)
  • Ebuyer ignores the input (no error)
  • Expansys removes the item from your basket
  • I'm assuming some site will show an error

Which is the best solution


Solution

    1. Add JavaScript verification that would remove non-numeric input while the user is typing in

    2. Implement backward solution for the situation when JavaScript is off, either display an error message or round the value but then display a message saying "your input has been adjusted"

    ADDED: Also be aware that the character that separates the fractional part from the integer one differs from country to country. In US I believe it is '.', in Europe it is usually ','. If your applications is targeted at customers in different countries with varying number representation, it would make sense to implement the support for both characters in your application logic. Otherwise some users will get format error messages without knowing why - non-techie people are often unaware of this format issue.