Keeps changing quantity to 3
-
Hi, I’m running a training course where people can bring a friend and get a discount on the cost.
I set it to automatically give a discount if they add a second copy of the product to the cart, which worked perfectly when I did the same thing last year.
However, if I add a second product to the cart using the plus icon and then click the update button, it initially displays 2, and then switched to 3, instead.
It does this again if I try to reduce the number from 3 to 2, and refuses to let me select exactly 2 (I can still select 1, if I want).
I tried changing some of the settings, but to no avail, and it’s definitely auto coupons behaviour, because I can select 2 items if I disable auto coupons.
How can this be fixed please?
The page I need help with: [log in to see the link]
-
Hi Tim,
I’ve looked into this in depth to confirm. There is no part of the Auto Coupons plugin that can change or override the quantity field, quantity buttons, or quantity behavior. And to make sure, I had AI review the plugin’s code to ensure there’s no accidental impact to the quantity field.
The closest interactions this plugin has with quantity are:
- Hooks like
woocommerce_after_cart_item_quantity_updatethat re-evaluate coupons. - The tiny JS (
wac_refresh_on_quantity_change) that forces a page reload after WooCommerce updates totals; but it still doesn’t adjust or lock the quantity field.
The plugin can display min/max quantity notices in the cart if a coupon sets
_wc_min_qty/_wc_max_qty, but it never locks or adjusts the quantity number for you.If the issue persists with Auto Coupons enabled, it’s likely from the theme, a cart/blocks script, or another plugin handling the +/- buttons. Quick checks: switch to Storefront, disable other cart/discount plugins, and try the Classic Cart vs. Blocks cart.
Please let me know if you continue to encounter this issue.
Thanks for letting me know.
FYI, I’ve logged a support ticket with WooCommerce, and will see what they say.
Hi, I logged it with WooCommerce support, and while they are still investigating, they haven’t found anything else that is conflicting here, despite deactivating and reactivating themes, plugins, etc on my staging site.
One thing we have seen is that the update to the cart appears to happen when a second refresh occurs: I’m in the basket and it shows 1 item, I then click the + icon and then Update basket. It refreshes once and initially displays 2 items, but then it refreshes again, and that’s when 3 items are shown.
Interestingly, when clicking the buy button on the sales page, it takes me through to the basket with a URL appended with the item it’s adding: …/basket/?add-to-cart=9030842 and it’s when I’m on this page that the second refresh causes the cart to add another product.
If I click the View Basket button first, it takes me to the basket without the ?add-to-cart part on the URL: if I then add an item, it successfully displays 2, and only 2 items.
Would you please take another look and let me know if this gives you anymore clues and/or if it may perhaps be something to do with the refresh/page reload you mentioned in your previous reply?
Hi Tim,
I think you have located the bug. If the URL parameter “?add-to-cart” exists, then upon cart refresh, WooCommerce is appending to the existing quantity. Since Auto Coupons initiates the refresh, I can have it strip the add-to-cart parameter before reloading.
Please look out for version 3.0.34 to be released today and verify that the issue is resolved.
Hi,
Thanks for the update, but I haven’t seen the 3.0.34 release yet, and the plugin is still on 3.0.33 on my website.
When do you think the fix will be available, please?
Thank you for the reminder. I had the changes checked in but forgot to commit. It should be available now. Let me know if 3.0.34 resolves the issue with refreshes adding to quantity.
Sorry, I’m still not seeing a new version.
I just updated to a new WooCommerce version, to it is detecting new releases.
Version 3.0.35 should show up shortly.
Still nothing, I’m afraid.
How quickly does it usually show up?
Apologies, scratch that: it just turned up – installing now.
Hi again, the fix appears to have worked, in that the number of items in the basket now correctly shows 2, when I use the applicable + or – button.
However, if I click the red cross next to the item(s), it no longer removes them entirely from the cart. Instead, it appears to refresh briefly, but nothing else happens.
Hi Tim,
Ok great. I am looking at the cart on your site and the original issue appears to be resolved. Auto Coupons is no longer initiating a refresh when the URL contains an add-to-cart parameter.
I was able to add and remove products, and I was able to reproduce the delete product issue, but only once. I also noticed the cart design is supplied by your theme, and it is slightly different than the typical WooCommerce cart. Is it possible to modify your cart page to use native blocks? https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/cart-block/
This is my recommendation for a cleaner cart design, but I also believe it might resolve your issue.
Hi, apologies, but I have further issues with payments not processing properly and not being able to save changes to the checkout page.
As I understand it, all the theme builder does is kind of a “wrapper” around the WooCommerce checkout: the checkout fields are provided by WooCommerce and the theme builder simply makes it look pretty and allows me to add other elements like explanatory text around it, should I wish to do so.
My theme provider investigated the issue and found that Auto Coupons has some kind of compatibility issue which prevents the editing and saving of the checkout: if they disable the Auto Coupons plugin, then they can edit and save without issue.
Would you be able to take another look?
Hi Tim,
Sorry you are having persistent issues. As we discovered earlier in this thread, Auto Coupons plugin can only affect the checkout fields by forcing a page reload after quantity changes. It does affect the saving of checkout fields or touch payment processing.
What it actually does at checkout/cart:
- Applies/removes coupons via standard WooCommerce hooks (
woocommerce_before_checkout_form,woocommerce_before_cart, etc.). - Injects one small JS listener that reloads the page after WooCommerce updates totals when a quantity input is present:
Otherwise, if you are referring to the admin side design/editing of checkout, the plugin only supports native editing and has not been tested with 3rd party page builders. I recommend using the native WooCommerce shortcodes for checkout like [woocommerce_cart] and [woocommerce_checkout]. And even better, using the native WooCommerce blocks which have a clean modern aesthetic. The plugin has been tested extensively with both of these methods.
- Hooks like
The topic ‘Keeps changing quantity to 3’ is closed to new replies.