Is there a way to implement an extra input field for the quantity? Perhaps have it default to 1 if the field is left blank.

Comments

xl_cheese created an issue. See original summary.

drugan’s picture

This feature is on the plan to be added the 8.x-1.x version first and then backported to the 7.x-1.x. Will be done as soon as I have time for this work. Anyway, would be glad to review a patch to any of the versions, if someone will contribute it.

nicolasgraph’s picture

StatusFileSize
new6.24 KB

Anyway, would be glad to review a patch to any of the versions, if someone will contribute it.

Here you are!
Thanks in advance for your review.

nicolasgraph’s picture

Status: Active » Needs review
nicolasgraph’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

  • drugan committed 9d15c42 on 8.x-1.x authored by NicolasGraph
    Issue #2934553 by NicolasGraph: Quantity Field For Quick Purchase
    
drugan’s picture

I've made some changes to your patch because the whole issue is a bit more complex than it might be seen.

First, the type of the field is changed to the #textfield as the #number quantity field must have appropriate #step and possibly #min and #max and #default_value properties set on the respective order item type quantity field widget settings. In our case it is impossible to know at his point these settings just because we don't know which variation will come with the autocomplete field. So that's why we need #textfield without any properties hardcoded into it. Remember there is some modules, like the https://www.drupal.org/project/commerce_xquantity which provide more settings to the quantity field.

Please, test the changes and if everything is okay then I'll make a new beta4 release.

  • drugan committed 94c88fb on 8.x-1.x
    Issue #2934553 by drugan, xl_cheese: Quantity Field For Quick Purchase (...
drugan’s picture

Status: Needs review » Fixed

Okay, a couple of final touches and now to the beta4 version.

Thank you all, guys!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.