# Spot the bug - #174: Cart Coupon Evaluator

**URL:** <https://forum.kirupa.com/t/spot-the-bug-174-cart-coupon-evaluator/683715>\
**Category:** web dev\
**Created:** [October 14, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-174-cart-coupon-evaluator/683715 "2026-10-14T07:00:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VaultBoy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/vaultboy/32/31832_2.png) [@VaultBoy](https://forum.kirupa.com/u/VaultBoy)\
**Post date:** [October 14, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-174-cart-coupon-evaluator/683715/1 "2026-10-14T07:00:10Z")

</div>

Why is this checkout coupon always triggering the default tier?

```js
function resolveDiscountTier(subtotal, promoCode) {
  let tier = 'STANDARD';
  const isVip = promoCode === 'VIP_HERO';

  switch (subtotal) {
    case subtotal >= 100 && isVip:
      tier = 'PLATINUM';
      break;
    case subtotal >= 100:
      tier = 'GOLD';
      break;
    case subtotal >= 50:
      tier = 'SILVER';
      break;
    default:
      tier = 'BRONZE';
  }
  return tier;
}

```

Reply with what is broken and how you would fix it.
