There's a Default quantity to add to cart" setting on the product edit form, but for reasons I don't quite get, this value is only effective if the quantity field is set to be shown (this option found by link in main settings).
Would there be any harm in allowing this default quantity to still apply even if this field isn't shown? The quantity field even seems to exist beside the button -- it's just hidden. But it's automatically set to "1" when not displayed.
Any thoughts? I think this is a change from older versions.
The below thread seemed to bring up the issue, but I think the issue became confused, with both parties talking about slightly different things :)
#352381-3: Default quantity to add to cart value not respected
Comment | File | Size | Author |
---|---|---|---|
#5 | 654834-default-qty-hidden.patch | 1.46 KB | longwave |
#3 | 654834-default_qty.patch | 828 bytes | sammys |
Comments
Comment #1
patcon CreditAttribution: patcon commentedOh hey, if anyone else is interested, just find
function uc_product_add_to_cart_form()
inuc_product.module
and changeto
Hopefully this helps someone else! Rock on, folks
Comment #2
patcon CreditAttribution: patcon commentedAnd the reason I needed this was because I have a minimum for a certain product, so it made since to start with that in the cart (I use Add to cart tweaks to empty the cart with each addition). Maybe not, but I thought others might want something similar :)
Comment #3
sammys CreditAttribution: sammys commentedI consider this a bug so I've switched it over to that. Created a patch so maintainers can easily test/commit the change.
Comment #4
patcon CreditAttribution: patcon commentedThanks Sammys. I've recently gotten into rolling patches, but hadn't at the time.
Comment #5
longwaveMakes sense to me, but you can explicitly set default qty to 0 to hide the quantity field per-product, which would then add 0 products when the field is hidden. I committed the attached patch, which will use a quantity of 1 if the field was explicitly hidden, and the default otherwise.
Needs porting to 7.x.
Comment #6
longwaveCommitted.