Copied to clipboard

Flag this post as spam?

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


  • Sibren 39 posts 211 karma points c-trib
    Jun 29, 2020 @ 18:30
    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 4124 posts 22215 karma points MVP 9x c-trib
    Jun 30, 2020 @ 08:13
    Matt Brailsford
    1

    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