Forums › Min Max Default Quantity for WooCommerce › Bug on decimal quantities
- Support forum for the WooCommerce Min Max Step Quantity Limits Manager.
- This topic has 7 replies, 3 voices, and was last updated 4 years, 11 months ago by
WPWhale.
-
AuthorPosts
-
March 20, 2020 at 10:08 am #104151
Lilian Domin
ParticipantHello, I bought the plugin today and have the following two problems.
1. I set a product with decimal quantities: min: 0.5, step: 0.1.
Now when I open the single product page, the quantity starts with the min value. After I pressed the quantity plus button three times, the quantity is not 0.8, it is 0,7999999999999999. Have the problems always after a few plus or minus adjustments (also e.q. 1,8000000000000003). It works finde with 0.5 steps btw.
2. If I have the same setup like in 1. and open the single product page (with quantity 0.5) and immediately add the product to card, it adds it with quantity 1, not 0.5. After changing the quantity it adds the product to card correctly. (I enabled “Force initial quantity on single product page” to min quantity)I look forward to your help.
-
This topic was modified 1 year, 10 months ago by
Omar Dabbas.
March 20, 2020 at 12:26 pm #104152WPWhale
ModeratorHello Lilian,
That looks like an odd case, it’s possible that the +/- buttons are controlled by specific code, does this happen if you increase the quantity using keyboard up arrow?
Is it possible to grant access to your site to check? If so, please add my email [email protected]
Omar
March 20, 2020 at 12:38 pm #104153Lilian Domin
ParticipantHello Omar,
It works finde with the keyboard arrows. Okay, then it seems to be an error in the theme JS. I already changed it, because it does only parse integers. But my JS is not the best and it doesn’t work with mobile chorme (mobile firefox works fine). Maybe someone can help me:
productQuantityAdjust: function() { // Increase jQuery(document).on('click', '.qty-plus', function(e) { e.preventDefault(); var quantityInput = jQuery(this).parents('.quantity').find('input.qty'), step = parseFloat(quantityInput.attr('step'), 10), newValue = parseFloat(quantityInput.val(), 10) + step, maxValue = parseFloat(quantityInput.attr('max'), 10); if (!maxValue) { maxValue = 9999999999; } if ( newValue = minValue ) { quantityInput.val(newValue); quantityInput.change(); } }); }
March 20, 2020 at 12:40 pm #104154Lilian Domin
ParticipantHere is an example product if it helps: https://naehli.de/produkt/biojersey-streifen-sand-von-stoffonkel/
March 20, 2020 at 1:02 pm #104155Lilian Domin
ParticipantHey Omar,
thanks for you’re help, but I fixed it. But 2. is still a problem.
Thanks
March 20, 2020 at 3:32 pm #104156WPWhale
ModeratorHi Lilian, glad to know you got it for the first problem.
As for number two, it looks that default quantity (when you open the page) is also controlled by theme JS, you can check that by increasing quantity to 0.6 and then change it back to 0.5, it will add 0.5 to the cart.
So it looks the theme overwrites the default quantity settings by WooCommerce (which the plugin overwrites), can you please check this as well?
Here is the function that controls it by your theme.
Please let me know if you still need any further help, and if you found the support useful, please leave us a rating.
Omar
March 24, 2020 at 4:00 am #104157Aaron Boyd
ParticipantHi Lilian, I am experiencing the same issue as your first problem. Just wondering what code you used to correct this? And where did you add the code?
I have a site ready to go live apart from this one annoyance.
Hope you can help?!March 28, 2020 at 7:30 pm #104158WPWhale
ModeratorHi Aaron,
Please contact us at [email protected] with a link to your store, I might be able to tell you where exactly you have to change.
Omar
-
This topic was modified 1 year, 10 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.