Skip to content
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

Conversation

kennyadsl
Copy link
Member

🚧🚧🚧

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:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)

@kennyadsl kennyadsl self-assigned this Sep 25, 2019
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?

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
@kennyadsl kennyadsl force-pushed the fix-order-level-promotion-with-non-promotable-items branch from 6617bf8 to ef5edd1 Compare September 26, 2019 08:50
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?
Copy link
Contributor

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?

Copy link
Member Author

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?

@aldesantis aldesantis added this to the 2.11 milestone May 22, 2020
@kennyadsl kennyadsl removed this from the 2.11 milestone Aug 28, 2020
@kennyadsl
Copy link
Member Author

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.

@kennyadsl kennyadsl closed this Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants