• Resolved mparsons501979

    (@mparsons501979)


    I’ve had a number of customers complaining about items being removed from their basket and I couldn’t figure out why until I just tried placing an order on my own website whilst it was live.

    When accessing the site as a guest, users can add products to their basket and they are reserved as expected. When they get to checkout they are prompted to log in as we only accept orders from logged in users. Once they do, a number of users find that one or more of their items are removed from the basket. This only happens when stock numbers are low. Say there is 1 inventory left and the ‘guest’ view does actually reserve the item but when they switch to a ‘logged in’ view, the plugin thinks they are a new user and can’t find any stock to allocate from the inventory. That’s because the single remaining item is in the ‘guest’ view.

    Is there a fix for this?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author James Golovich

    (@jamesgol)

    I just tried to reproduce this behavior and I’m not able to.

    As admin, I created a new Simple Product with a stock of 1.
    As a non-logged in user, I added that item to my cart.
    Then logged in as an existing user.
    The item was transferred to the logged in users cart and I was able to checkout and purchase the item.

    If you can give me some steps to reproduce the issue, I’ll see if I can reproduce it and figure out what the problem is.

    What versions are you using? What theme/version? What other WooCommerce related plugins are active?

    Thread Starter mparsons501979

    (@mparsons501979)

    Hi James, I really appreciate the quick reply and the offer to investigate this.

    My theory in my original post is about as much sense as I can make using the evidence I have. It’s very difficult to reproduce as my store has to be live and other users have to be on the site ordering at the same time.

    My step-by-step actions were to visit the site as a guest, add a few items to my basket and then proceed to checkout. At checkout I navigated to ‘log-in’ in the hamburger menu (as viewed on a mobile phone) and proceeded to log in. As soon as the login occurred, the checkout screen re-loaded and one of the items was flagged in a Woocommerce error message to say it was no longer in stock and the checkout button was disabled.

    I can only think the guest session remained with the item reserved in that guest basket and the new logged in session wasn’t able to select it. Hope you follow my logic.

    I’m running the following:

    WP 5.7
    Storefront 3.5.0
    Cart stock reducer 3.30
    WC 5.1.0
    Min/Max quantity for WC 1.2.13.5 (no rules set)
    Advanced Order Export for WC 3.1.8
    WC Paypal Checkout Gateway 2.1.1
    WC Stripe Gateway 4.9.0
    WC GA integration 1.5.1
    Booster for WC 5.3.8 (1 module active – shipping methods by min/max order amount
    WC PDF invoices and packing slips 2.8.2

    That should be all the relevant plugins, there are more non-WC plugins that I use so can provide those if you need them.

    Many thanks.

    Thread Starter mparsons501979

    (@mparsons501979)

    Hi James, I’ve just managed to re-create it and it’s not actually as I first thought. Please disregard my theory above.

    What is happening is that the system is allowing more than 1 user to add the products to their basket regardless of the remaining inventory stock.

    To explain that a bit better, I just visited the site from my admin on 1 browser and as a guest on another browser. I targeted a product that I know only has 2 left in the inventory and there were no others in any other carts.

    I added 1 to my basket in my admin browser using the ‘add to basket’ button. I then added another using the same button and quickly went over to my other guest browser where I was successfully able to add another item. So that resulted in 3 stock being allocated to baskets when there is only 2 in the inventory.

    I then clicked on ‘view basket’ on the guest browser and it showed the WooCommerce error that the product is not in stock.

    So, I’m wondering if this isn’t in fact a Cart Stock Reducer issue but more a WooCommerce issue. What do you think? Surely there must be a timestamp on each ‘add to basket’ request that prevents more than the inventory total being added to baskets?

    My site is very popular at certain times of the week so can have up to 100 users trying to secure products at once. Having this error repeating every week isn’t reflecting well on the website as customers are getting frustrated with items disappearing from their basket.

    Any insight you can provide would be very useful. Many thanks.

    Plugin Author James Golovich

    (@jamesgol)

    I’m going to have to do some further testing. Before WooCommerce 3.0 the session handling was much easier, but when 3.0 came out they attached saving the session to the shutdown WordPress action which triggers at the end of the request. So the window for this race condition to happen is much larger and it only gets worse depending on the server speed/load and amount of plugins installed.

    Thread Starter mparsons501979

    (@mparsons501979)

    Thank you very much for taking a look. If you need any more information then please let me know. I can send a copy of my WC status output if that helps. I can confirm that the server load was high at the time of the initial customer complaints over the past few weeks but the occurrence yesterday during my testing – there was nobody on the site but me.

    Thread Starter mparsons501979

    (@mparsons501979)

    @jamesgol can you please let me know if you have had any joy with your testing?

    Plugin Author James Golovich

    (@jamesgol)

    I have not had an opportunity to work on this yet.

    the same issue here

    Thread Starter mparsons501979

    (@mparsons501979)

    @jamesgol thanks for the update. I appreciate you’re busy but I had another shop session yesterday that resulted in a customer complaint due to them not being able to checkout without items disappearing from their basket. They abandoned the purchase in the end which is detrimental to my client’s business and they’re pressing me for a resolution.

    I’m sure there were other occurrences that weren’t reported as I saw an instance in the back-end that there was more stock allocated in carts than was in the inventory against a particular product. I took a screenshot which I can email to you if needed.

    The next shop is on Sunday so I hope you’re able to spend some time on this before then.

    Thank you.

    Thread Starter mparsons501979

    (@mparsons501979)

    @jamesgol are you looking into this?

    Plugin Author James Golovich

    (@jamesgol)

    Not actively, but it is on my to-do list.

    Plugin Author James Golovich

    (@jamesgol)

    I just pushed out version 3.40 that should help with this issue. I’m now forcing WooCommerce to save the session as soon as an item is added to the cart instead of waiting until the end of the HTTP request (at WordPress action ‘shutdown’).

    Thread Starter mparsons501979

    (@mparsons501979)

    @jamesgol tremendous, thank you very much. Update is downloaded and I’ll monitor for any issues going forward. Really appreciate you looking into this for me.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Product reservation not working when user changes from guest to logged in’ is closed to new replies.