Hi All, We have a project that requires the use of...
# support
b
Hi All, We have a project that requires the use of stock batches due to expiration dates of the inventory (perishable goods). It does not seem that batch management is included natively in Solidus; would the use of stock location as an individual batch (multiple batches are assigned to products / product variants) be an option? It should be noted that in addition to the natural use of batch management for perishable goods which includes the concept of First to Expire First Out (FEFO), we will build out promotion logic that will help liquidate inventory progressively before (and after) expiration dates. Thanks so much to anyone who has experience with this specific topic or to others that have a clever work-around.
m
I would model this as something other than stock locations, outside of any Solidus classes. You will have to heavily patch stock management, but don't bolt it on to something that's designed for something else...
b
@mamhoff, Thanks for your reaction and opinion against (mis)using the Stock location in order to achieve our aim. I will hold out hope that someone on this forum has the same use case and solution that they can share :)
j
That's a tricky one. You're going to need to keep track of how much has sold from a given batch and sell from the oldest batch and all that. I'd almost want to just track them as separate variants and just add some fun stuff to control their availability and make that opaque to the customer on the frontend... but I don't even really like that solution. I think anything you do here will be tricky to get right.
b
@Jared Norman Thanks for your thoughts on this one. I am still holding out hope for the (unlikely) developer that has implemented a perishable inventory management actually on Solidus (I have this functionality in my ERP; however, we are not integrating the ERP at this stage).
s
Never done this but it has been a low priority request in our backlog for forever. Grain of salt because I haven’t fully thought this through, but I’d first explore implementing “stock batches” as a separate model, that has many inventory units. Then you’d need to: • Patch stock management to add/remove inventory units to/from specific batches (or create new ones where applicable) • Backfill all the things • Create a custom stock coordinator to sort inventory units by their batches expiry date before assigning them to packages (maybe sort first then just super back into the vanilla simple coordinator to allow default Solidus logic to take it from there) The risk is making stock management and coordination brittle to change, and stock-related bugs you introduce have a nasty habit of being hard to find/diagnose sometimes. Also things like back orders and cancellations might introduce some edge cases or complications. Probably worth a lot more thought than I’ve put into it so far, but maybe that helps here some!
b
@Sean Denny (he/him), Thanks for your insights (and videos as well!!). We are definitely nervous due to the notorious stock-related bugs 😵‍💫 Thankfully, we won't have backorders, but cancellations are a great call-out. Will dig into your suggestions and post back to the community as we progress with our solution. Thanks!
i
Is my understanding correct that the end goal is FEFO for inventory with the ability to promote quantities based on dates/batches? This is what comes to mind: • As already mentioned, we would want to avoid adapting stock locations but hook into inventory units. • We need a Batch model for inventory units to "belong to" -- inventory units will get a new column for this. • The Batch model will store the expiry date for all inventory units that "belong to" it and be open for extension in the future. • Promotions have access to line items, so there will need to be some good SQL here to promote a specific inventory count based on the batch number/date of expiry defined in the promotion. • Then, of course, a custom stock coordinator will utilise the batch model to allocate inventory correctly -- the items are, presumably, in stock, which makes it simpler. • The admin UI for allocating new stock will need to be altered to support batch-based updates. I would need input about potential issues here, as nothing has popped into mind.
Promotion re-calculations before payment might be needed if there is a lot of traffic to ensure more accurate discounts being applied based on already-sold batch stock
b
@Ikraam Ghoor , thanks a lot for your thoughts! To the extent that the promotions can be limited to a maximum of the remaining stock on hand prior to discounting, I’m hopeful that the standard promotions functionality would limit discounting on batches that are not yet expiring. At the same time, the front end displaying of the discounted stock could get tricky, I think. Very thankful for your help in thinking this one through!
❤️ 1