• Hey!

    A problem have now occurred.

    If 2 customers are adding the last item in stock the same second, both get the product to its cart but no one can proceed to checkout because woocommerce thinks its out of stock. But someone need to proceed. The one how has the best connection should get the item.

    I hope you can help me with this. Planning to release the site in 1 week.

    Best regards
    Christian.

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

    (@jamesgol)

    Sorry, I didn’t see the notification about this message.

    I’m not sure what has changed to make this problem worse, maybe WooCommerce is running faster/slower so the timing issue is hit more frequently.

    I’ve come up with a fix to make this race condition window very small, I’m still doing some testing and will be pushing out a new release soon.

    Thread Starter Agenci Marknadsbyr?

    (@widerclothing)

    Thank you for your reply!

    Haha first i thought you tried to avoid this question. But really nice to hear that. Is it something that will happened this week or couple of weeks?

    Best Regards,
    Christian!

    Plugin Author James Golovich

    (@jamesgol)

    I pushed out a release the same day as my post.

    Thread Starter Agenci Marknadsbyr?

    (@widerclothing)

    Just updated the plugin but still some problems when 2 customers click at the cart the exact same second (is better, because when i did with my computer and phone only my phone got the product in cart). My question is if there is a way to have the code or something that make the quanity check never goes over whats in stock. For an example when adding one more product in cart it goes back to 1 because its only 1 in stock?

    I have been searching on the web for this code but i havent found any, except from your plugin.

    Thank you for your hard work on this plugin!

    Plugin Author James Golovich

    (@jamesgol)

    It will take some significant work to completely eliminate the problem, I built the plugin based on WooCommerce pre 3.0 and this was not an issue then but their major changes caused significant performance issues with the way the plugin was verifying quantities.

    The issue is the time between the SQL query to check the quantity in the carts and when the cart is saved with the item in it. You could try adding a random 20-100ms delay before the ‘woocommerce_add_to_cart_validation’ filter is called and that could help, but that’s not the type of fix I’d push out in a release.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem with cart’ is closed to new replies.