Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sibren 28 posts 150 karma points
    1 week ago
    Sibren
    0

    Can stock change when added to cart

    Hi,

    If a customer adds an item to cart, can I change the stock? Or have some kind of shadow-stock?

    Like.. When somebody else adds it to their shopping cart, it reduces the stock for two hours until buying?

  • Matt Brailsford 2576 posts 12723 karma points MVP 7x c-trib
    1 week ago
    Matt Brailsford
    0

    Hi Sibren,

    We don't have anything built in for this so it would require some custom development.

    Best approach I could think of would be to create a custom in memory cache storing the an order id + product ref + qty and then combining this with your product page logic to define the stock as being the stock level on record - whatever is in the memory cache. You'd then need some kind of sliding expiration on the cache.

    You should be able to hook into events to know when something is added to cart and you could also create some custom validation handlers to prevent an item being added if the cumulative stock level goes below 0.

    Hope this helps

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft