-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow order level promotions with non promotable items #3348
Allow order level promotions with non promotable items #3348
Conversation
when Spree::Order | ||
promotable.line_items.joins(:product).where(spree_products: { promotionable: false }).exists? | ||
# when Spree::Order | ||
# promotable.line_items.joins(:product).where(spree_products: { promotionable: false }).exists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/CommentIndentation: Incorrect indentation detected (column 6 instead of 8).
still needs tests and a configuration that allows not changing existing stores behavior, see solidusio#1925
6617bf8
to
ef5edd1
Compare
when Spree::Order | ||
promotable.line_items.joins(:product).where(spree_products: { promotionable: false }).exists? | ||
# when Spree::Order | ||
# promotable.line_items.joins(:product).where(spree_products: { promotionable: false }).exists? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option could be to perform a check like so:
promotable.line_items.any? &&
!promotable.line_items.joins(:product).where(spree_products: { promotionable: true }).any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion. Do you mean that we could perform this check instead of removing this code?
Closing this. It tries to fix a bug but I don't know if it's still the best way to handle the problem now. This spike will still be attached to the main issue, which will be kept open. |
🚧🚧🚧
Description
This PR allows applying order-level promotions to orders with some non-promotionable line items.
Those line items will not be taken into account in promotion computations since store owners could have their good reasons to exclude them from being promotionable.
ref: #1925, #1437 and #3339
WIP This is just a spike, it still needs:
Thanks, @cedum for the help in the in-depth analysis.
Checklist: