diff --git a/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php b/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php index b45413a4..b6f81dc7 100644 --- a/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php +++ b/app/Classes/Modules/Affiliate/Services/TracksAffiliateOrder.php @@ -49,7 +49,11 @@ class TracksAffiliateOrder // We'll use a KeyValuePair to track which bookings have been counted $kvpKey = 'affiliate_order_tracked_' . $affiliate->id; - if ($booking->hasAttribute($kvpKey)) { + $existingKvp = $booking->attributesKVP() + ->where('key', $kvpKey) + ->exists(); + + if ($existingKvp) { return $affiliate; // Already counted }