ソースを参照

add hook accept_free_order

andre 4 年 前
コミット
db7f4a0474
1 ファイル変更18 行追加0 行削除
  1. 18 0
      accept_free_order.php

+ 18 - 0
accept_free_order.php

@@ -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;
+	    }
+	}
+});