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

Fixes customer group in Discounts #2046

Open
wants to merge 3 commits into
base: 1.x
Choose a base branch
from

Conversation

yasirmturk
Copy link
Contributor

Fixes #2045

Copy link

vercel bot commented Jan 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 3:50pm

Copy link
Collaborator

@alecritson alecritson left a comment

Choose a reason for hiding this comment

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

Thanks @yasirmturk I think we should try to avoid nested if statements and elseif's

@yasirmturk
Copy link
Contributor Author

I agree @alecritson , what do you suggest? conditional or null colescing statement?

@alecritson
Copy link
Collaborator

I agree @alecritson , what do you suggest? conditional or null colescing statement?

I kind of think that we should always consider the customer's groups, regardless, so maybe something like this:

if ($cart && $customerGroups = $cart->customer?->customerGroups) {
    $this->customerGroup($customerGroups);
}

if ($this->customerGroups->isEmpty() && $defaultGroup = CustomerGroup::getDefault()) {
    $this->customerGroup($defaultGroup);
}

What do you think?

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.

Customer groups of cart customer are not considered by Discounts
2 participants