onCouponValidationFailed
Last updated
Last updated
exports['sd-shops']:registerClientHook('onCouponValidationFailed', function(data)
-- Play error sound
PlaySoundFrontend(-1, 'ERROR', 'HUD_FRONTEND_DEFAULT_SOUNDSET', true)
-- Show error notification
lib.notify({
title = 'Invalid Coupon',
description = data.reasonMessage,
type = 'error'
})
-- Handle specific failure reasons
if data.reason == 'min_purchase_not_met' then
lib.notify({
description = 'Add more items to use this coupon',
type = 'warning'
})
elseif data.reason == 'expired' then
print(('[COUPON] Attempted expired coupon: %s'):format(data.couponCode))
end
end)