Skip to content

Commit

Permalink
Fix: Error selecting applicable discounts (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
se09deluca authored Jan 11, 2024
1 parent 950587f commit ff999fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/Managers/DiscountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ function ($query, $value) {
}
)->when(
$cart?->coupon_code,
fn ($query, $value) => $query->where('coupon', '=', $value)->orWhere(fn ($query) => $query->whereNull('coupon')->orWhere('coupon', '')),
function ($query, $value) {
return $query->where(function ($query) use ($value) {
$query->where('coupon', $value)
->orWhereNull('coupon')
->orWhere('coupon', '');
});
},
fn ($query, $value) => $query->whereNull('coupon')->orWhere('coupon', '')
)->orderBy('priority', 'desc')
->orderBy('id')
Expand Down

1 comment on commit ff999fe

@vercel
Copy link

@vercel vercel bot commented on ff999fe Jan 11, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.