The site build with Virtuemart, and the trigger is config correct with order success.
But it seems that part of the used coupons was saved to history and part don't.
I think there is a problem with this TIMESTAMPDIFF calculation, first of all the function get 15 last minute and not 2 days and it is a problem when the server configuration to different time zone because the time that the created_at
column was created could be different, and with this function the temp record that the component create was delete before the real one is created and cause to the history not to be saved.
And when I have changed it to TIMESTAMPDIFF(DAY,created_at,now())>2 the component start to work perfect.
Any advised what to do or if you see it as a bug?