• Great plugin, thanks for the contribution. The plugin is exactly what I need but I have a particular concern with the ability of a single customer to virtually consume all stock.

    I’ve configured my site to only allow customers to checkout with 1-2 items in their cart. So this means if the customer has added 10 of item X to their cart when they proceed to checkout they will be denied with an error.

    The issue is that the virtual stock levels are reduced when customers add items to their cart. So if I only have 10 of item X in stock and they increase their cart quantity to 10, although they cannot checkout they are now holding the virtual stock in their cart. This means that other customers will see the product as sold out.

    Do you have any ideas on how to approach this problem? Thanks.

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

    (@jamesgol)

    I suspect there are quite a few ways to handle that situation.

    One of the easiest that would be the most flexible would be to hook into one of the actions/filters that are called from the WC_Cart->add_to_cart() function. Create a function that counts how many items they have in their cart and if it’s >= 2 then throw an exception.

    The add_to_cart() function with catch the exception and return the response back to the user. So you can then return a proper error notice to the user.

Viewing 1 replies (of 1 total)
  • The topic ‘Customer can hold all virtual stock in cart’ is closed to new replies.