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

Fix caching bug when calculating available discounts #3902

Open
wants to merge 4 commits into
base: 5.x
Choose a base branch
from

Conversation

lukeholder
Copy link
Member

No description provided.

Copy link

linear bot commented Feb 20, 2025

@lukeholder
Copy link
Member Author

To get this PR fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-feature/pt-2457-5x-discount-dont-work-if-custom-price-calculation-for as 5.3.3",
  "...": "..."
}

Then run composer update.

We will update this PR once the release is out that includes this PR.

@lukeholder lukeholder changed the title Fix caching big when calculating available discounts Fix caching bug when calculating available discounts Feb 21, 2025
@lukeholder lukeholder marked this pull request as ready for review February 21, 2025 11:46
@lukeholder lukeholder requested a review from a team as a code owner February 21, 2025 11:46
[ci skip]
@@ -330,12 +343,12 @@ public function getAllActiveDiscounts(?Order $order = null): array

// Pre-qualify discounts based on purchase total
if ($order) {
if ($order->getEmail()) {
if ($orderEmail) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check if $orderEmail !== '*' based on the code further up? Either that or leave this code as $order->getEmail()

Copy link
Contributor

Choose a reason for hiding this comment

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

Although I suppose it is already checking the $order variable so should be fine

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.

2 participants