accept_free_order.php 466 B

123456789101112131415161718
  1. <?php
  2. // this hook sets the order status to accepted if order is free
  3. if (!defined("WHMCS"))
  4. die("This file cannot be accessed directly");
  5. add_hook('AfterShoppingCartCheckout', 1, function($vars) {
  6. if($vars['TotalDue'] == 0) {
  7. $api = localAPI('acceptorder', array('orderid' => $vars['OrderID']));
  8. if ($api['result'] == 'success') {
  9. return true;
  10. } else {
  11. $errormessage .= $api['message'];
  12. return false;
  13. }
  14. }
  15. });