Skip to content

Commit

Permalink
Support blank and null coupons (#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell authored Oct 6, 2023
1 parent ecb29f1 commit 2a1c79a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/Managers/DiscountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public function getDiscounts(Cart $cart = null): Collection
)
)->when(
$cart?->coupon_code,
fn ($query, $value) => $query->where('coupon', '=', $value)->orWhereNull('coupon'),
fn ($query, $value) => $query->whereNull('coupon')
fn ($query, $value) => $query->where('coupon', '=', $value)->orWhere(fn ($query) => $query->whereNull('coupon')->orWhere('coupon', '')),
fn ($query, $value) => $query->whereNull('coupon')->orWhere('coupon', '')
)->orderBy('priority', 'desc')
->orderBy('id')
->get();
Expand Down

1 comment on commit 2a1c79a

@vercel
Copy link

@vercel vercel bot commented on 2a1c79a Oct 6, 2023

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.