Customize Loyalty Program

Hi there,
I want to classify my customers in groups. If my customers spend 2 $ in 2 years, they would be marked as VIP automatically. How can I do it with ERPNEXT Loyalty program ?
Thank you

trigger event after_submit in sales invoice after get all sales invoices by customer and calculate and update to VIP where ever you want check this link Hooks