Reply To: Automatic approval with coupon

Thanks a lot Feryaz,

With your help I was able to make a code that works.

For those interested this is the code:

if ($coupon === ‘ENTER COUPON NAME HERE’) {
try {
easyreservations_auto_approve($res, true);
} catch (easyException $e) {
// do nothing

PS: I mentioned some bugs I had to fix to make things working(the code was dividing by zero so it didnt work), here is the fix to having bookings that cost 0 be set to paid:


if($res->price == 0) echo 100; elseif($res->paid == 0) echo 0; else echo round(100/$res->price*$res->paid, 0); ?>% <?php printf ( __( 'Paid' , 'easyReservations' ));

remember to keep opening and closing syntax, had to remove them here since the forum was bugging it