|
@@ -0,0 +1,18 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+// this hook sets the order status to accepted if order is free
|
|
|
|
|
+
|
|
|
|
|
+if (!defined("WHMCS"))
|
|
|
|
|
+ die("This file cannot be accessed directly");
|
|
|
|
|
+
|
|
|
|
|
+add_hook('AfterShoppingCartCheckout', 1, function($vars) {
|
|
|
|
|
+ if($vars['TotalDue'] == 0) {
|
|
|
|
|
+ $api = localAPI('acceptorder', array('orderid' => $vars['OrderID']));
|
|
|
|
|
+ if ($api['result'] == 'success') {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $errormessage .= $api['message'];
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+});
|