-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Max quantity for bulk buy implementation is too complicated #334
Comments
A note that I would expect this to be completely redone when we implement the new network structure as the bulk buy variant will become the base of other combination / split variants. So definitely the way it is done now can be done away with. Could this be a case of a good first implementation of new network structure (alongside the customer prices)? We need to keep this functionality as we have people using it, but it we need to pull out out / redo to enable spree upgrade then we should think through and create the new architecture that we ultimately want? @myriamboure @luisramos0 @sauloperez @HugsDaniel |
This is not required for the spree upgrade. |
Count on us to tell you the story whenever you want @luisramos0 we love telling those kind of stories :-) Agree with you on principle @kirstenalarsen even thought I think we will need to implement first some product chain basic features before we touch this so it might be something that happen a bit later in the process... without the backbone of new product chain not sure we can redo this, but we can think about it ! If not touched by Spree upgrade no hurry :-) |
Description
Reviewing openfoodfoundation/openfoodnetwork#2880 (comment) I noticed that our bulk buy implementation is overly complicated and confusing. The idea of bulk buy is that the shop orders in bulk, which is cheaper. For example 50 kg bags of potatoes have better value (per kg) than 5 kg bags. The big bag gets split up for customers, depending how much they want. Customers order the desired quantity of a product, for example 3 kg of potatoes. But they can also indicate that they would take up to 5 kg of potatoes if it's necessary to make bulk buy work.
In the current code we modified the
Spree::LineItem
model and added another field calledmax_quantity
. It is optional and can be activated on product level (fieldgroup_buy
). In order to make this work, we had to override a lot of Spree logic to pass themax_quantity
through any stock logic.Expected Behavior
The implementation is small and easy to understand. It is separate from Spree's logic and behaves like an optional add-on.
Actual Behavior
We modified a lot of Spree logic which makes upgrades difficult.
Steps to Reproduce
Some of the affected code:
Context
We are working on the Spree upgrade and decided that we should not include this in the current upgrade. This can be done separately and it shouldn't delay the upgrade. It's tech debt to be paid after the Spree upgrade.
Possible Fix
Implement a new model called
QuantityRange
which belongs to aLineItem
. It would also allow us to set a minimum quantity if that feature is requested.The text was updated successfully, but these errors were encountered: