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

Deprecate Promotion any Match Policy #4304

Merged
merged 5 commits into from
Apr 20, 2022

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Mar 17, 2022

Working with the promotion system is made much more complex because Solidus has a feature that allows a promotion to consider an order / line item eligible if any of its rules matches. The same behavior can be obtained - with much greater flexibility - by creating separate promotions for each rule.

Currently, we need to check order-level and line-item level eligibility on once for every line item, and that's only necessary because we allow a match policy of any. If only all match_policy promotions existed, we could first check the order eligibility and then check line item eligibility using only line-item applicable rules, which would be a major performance boost and would make the eligibility checks a lot more understandable.

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)

@mamhoff mamhoff force-pushed the deprecate-promotion-any-policy branch 3 times, most recently from d1e72cd to e23326e Compare March 18, 2022 08:50
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that change very much. I think we should tell people how to re-enable the deprecated behavior in their stores. Very nice touch with the deprecated examples feature.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments/questions but overall this is a nice job, thanks!

5minpause added a commit to TILCRA/solidus that referenced this pull request Mar 22, 2022
If we reduce the amount of promotions that can be activated, the
performance when refreshing the cart improves dramatically.

Eventually, this might not be necessary since Solidus#master branch is
updated with solidusio#4304 and
solidusio#4296.
Until those land in master and we are able to update to Solidus 3.2, we need to
maintain this fork.
@mamhoff mamhoff force-pushed the deprecate-promotion-any-policy branch 5 times, most recently from 38c394a to dded3f0 Compare March 28, 2022 12:09
Using the "any" match policy on promotions creates a lot of difficulty
when working with the promotion system. A recent poll on the Solidus
Slack indicated that most stores do not use these.

It is also from the user's point of view preferable to create separate
promotions for each rule in this case, as this will allow store owners
to set individual start and end dates and so on for each rule.
@mamhoff mamhoff force-pushed the deprecate-promotion-any-policy branch from dded3f0 to 5732d42 Compare March 31, 2022 11:46
mamhoff added 4 commits April 1, 2022 17:02
A promotion that has a match_policy of "any", but not more than 1 rule,
can also have a match_policy of "all" with no change in behavior. This
will stop a lot of people from getting deprecation warnings.
This allows us to mark a block as testing deprecated code so that it can
easily be identified and removed in the future.
@mamhoff mamhoff force-pushed the deprecate-promotion-any-policy branch from 5732d42 to b3ea863 Compare April 1, 2022 15:03
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you 👍

@tvdeyen tvdeyen merged commit a137ae1 into solidusio:master Apr 20, 2022
new_promotion = promotion.dup
new_promotion.promotion_rules = [rule]
new_promotion.match_policy = "all"
new_promotion.promotion_actions = promotion.actions.map do |action|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this is going to create many extra actions 🤔 For example, having 3 rules will cause 12 actions to be created due to the nesting. Though, it will end up with the correct set of actions due to promotion_actions =

kennyadsl added a commit to nebulab/solidus that referenced this pull request Mar 22, 2023
We are going to remove this preference in Solidus 4.0. The only accepted
value for who wants to upgrade is false.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Mar 27, 2023
…g policy

Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Mar 27, 2023
We are going to remove this preference in Solidus 4.0. The only accepted
value for who wants to upgrade is false.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Mar 27, 2023
…g policy

Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Mar 27, 2023
…g policy

Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

This change also removes the rake task we provided to update the
existing promotions. That script needs to be executed on previous
versions of Solidus only.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Apr 12, 2023
…g policy

Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

This change also removes the rake task we provided to update the
existing promotions. That script needs to be executed on previous
versions of Solidus only.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Apr 14, 2023
…g policy

Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

This change also removes the rake task we provided to update the
existing promotions. That script needs to be executed on previous
versions of Solidus only.

Ref solidusio#4304
kennyadsl added a commit to nebulab/solidus that referenced this pull request Apr 18, 2023
Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

This change also removes the rake task we provided to update the
existing promotions. That script needs to be executed on previous
versions of Solidus only.

Ref solidusio#4304
kennyadsl added a commit that referenced this pull request Apr 18, 2023
Matching "all" rules is the only supported path now. You can have the
same effect of the previoys "any" matching policy by creating multiple
promotions with the same configuration.

This change also removes the rake task we provided to update the
existing promotions. That script needs to be executed on previous
versions of Solidus only.

Ref #4304
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.

6 participants