{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Shopping Cart","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"shopping-cart","__idx":0},"children":["Shopping Cart"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following hooks are provided for Shopping Cart related events."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"acceptorder","__idx":1},"children":["AcceptOrder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Runs when an order is accepted prior to any acceptance actions being executed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters","__idx":2},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response","__idx":3},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code","__idx":4},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('AcceptOrder', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"addonfraud","__idx":5},"children":["AddonFraud"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when an addon is set as fraud."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-1","__idx":6},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["id"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The addon ID (tblhostingaddons)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["addonid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The predefined addon ID (tbladdons)"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-1","__idx":7},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-1","__idx":8},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('AddonFraud', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"aftercalculatecarttotals","__idx":9},"children":["AfterCalculateCartTotals"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes after the cart totals have been calculated."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-2","__idx":10},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["total"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["\\Price"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Total due today"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-2","__idx":11},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-2","__idx":12},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('AfterCalculateCartTotals', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"afterfraudcheck","__idx":13},"children":["AfterFraudCheck"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes after a fraud check has been completed"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-3","__idx":14},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the order that has been fraud checked"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ordernumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the invoice generated on order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["amount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount the order was for"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["fraudresults"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full result from the fraud check"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["isfraud"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Has the check been deemed as fraud"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["frauderror"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The details of the fraud check if an error occurs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientdetails"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full details of the client the order is for"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-3","__idx":15},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-3","__idx":16},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('AfterFraudCheck', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"aftershoppingcartcheckout","__idx":17},"children":["AfterShoppingCartCheckout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Upon completion of checkout once the order has been created, invoice generated and all email notifications sent."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-4","__idx":18},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OrderID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Order ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["OrderNumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The randomly generated order number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ServiceIDs"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of Service IDs created by the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["AddonIDs"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of Addon IDs created by the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["DomainIDs"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of Domain IDs created by the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["RenewalIDs"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of Domain Renewal IDs created by the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["PaymentMethod"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The payment gateway selected"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["InvoiceID"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Invoice ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TotalDue"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The total amount due"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-4","__idx":19},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-4","__idx":20},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('AfterShoppingCartCheckout', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cancelorder","__idx":21},"children":["CancelOrder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Runs when an order is requested to be cancelled, prior to the change of status actually occurring."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-5","__idx":22},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-5","__idx":23},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-5","__idx":24},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('CancelOrder', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cartitemstax","__idx":25},"children":["CartItemsTax"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Invoked as tax is being calculated for both cart and checkout, this can be used to manipulate"," ","the tax rate applied to the cart total or relevant checkout payment intents."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-6","__idx":26},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientData"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["null"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["cartData"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["\\ItemInterface[]"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of all data held within in the shopping cart."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-6","__idx":27},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return an array of the manipulated ItemInterface items. Tax will"," ","be calculated from the delta of the original items."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-6","__idx":28},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\View\\Formatter\\Price;\n\nadd_hook('CartItemsTax', '1', function ($vars) {\n    $cartItems = $vars['cartData'];\n    $client = $vars['clientData'];\n\n    // Calculate your tax rate to apply\n    $taxRate = 1.5; // 50%\n\n    /** @var \\WHMCS\\Cart\\Item\\ItemInterface $item */\n    foreach ($cartItems as $item) {\n        if (!$item->isTaxed()) {\n            continue;\n        }\n\n        /** @var Price $amountToday */\n        $amountToday = $item->getAmount();\n\n        // Set the price due today for the item\n        $item->setAmount(new Price(\n            ($amountToday->toNumeric() * $taxRate),\n            $amountToday->getCurrency()\n        ));\n\n        if ($item->isRecurring()) {\n            /** @var Price $recurringAmount */\n            $recurringAmount = $item->getRecurringAmount();\n            // Set the recurring price of the item\n            $item->setRecurringAmount(\n                new Price(\n                    ($recurringAmount->toNumeric() * $taxRate),\n                    $recurringAmount->getCurrency()\n                )\n            );\n        }\n    }\n\n    return [\n        'cartData' => $cartItems\n    ];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cartsubdomainvalidation","__idx":29},"children":["CartSubdomainValidation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when Cart Subdomain Validation is occurring"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-7","__idx":30},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["subdomain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["eg sub in sub.whmcs.com"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["eg whmcs.com in sub.whmcs.com"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-7","__idx":31},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return any validation errors. eg: return array('error1', 'error2',);"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-7","__idx":32},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('CartSubdomainValidation', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"carttotaladjustment","__idx":33},"children":["CartTotalAdjustment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Invoked as the order total is being calculated, this can be used to manipulate the final total."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-8","__idx":34},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of products in the shopping cart. Keys include ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pid"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["billingcycle"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["configoptions"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["customfields"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["addons"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["server"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["hostname"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domains"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of domain registrations & transfers in the shopping cart. Keys include ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["domain"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["regperiod"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-8","__idx":35},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return an array consisting of adjustment ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amount"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["taxed"]}," (bool)"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-8","__idx":36},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('CartTotalAdjustment', 1, function($vars) {\n    $cart_adjustments = array();\n\n    $products = $tlds = [];\n\n    foreach ($vars['products'] as $product) {\n        $products[] = $product['pid'];\n    }\n\n    foreach ($vars['domains'] as $domain) {\n        if ($domain['type'] == 'register') {\n            $domainParts = explode('.', $domain['domain'], 2);\n            $tlds[] = $domainParts[1];\n        }\n    }\n\n    if (in_array(1, $products) && in_array('co.uk', $tlds)) {\n        $cart_adjustments = [\n            \"description\" => \"Custom discount for buying product 1 and a co.uk domain\",\n            \"amount\" => \"-18.00\",\n            \"taxed\" => false,\n        ];\n    }\n    return $cart_adjustments;\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"deleteorder","__idx":37},"children":["DeleteOrder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Runs when an order is requested to be deleted, prior to the deletion actually occurring."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-9","__idx":38},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-9","__idx":39},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-9","__idx":40},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('DeleteOrder', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fraudcheckawaitinguserinput","__idx":41},"children":["FraudCheckAwaitingUserInput"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the fraud check is awaiting user input."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-10","__idx":42},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the order that has been fraud checked"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ordernumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the invoice generated on order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["amount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount the order was for"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["fraudresults"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full result from the fraud check"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["isfraud"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The details of the fraud check if an error occurs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientdetails"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full details of the client the order is for"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-10","__idx":43},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-10","__idx":44},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('FraudCheckAwaitingUserInput', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fraudcheckfailed","__idx":45},"children":["FraudCheckFailed"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the fraud check fails for a new order."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-11","__idx":46},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the order that has been fraud checked"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ordernumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the invoice generated on order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["amount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount the order was for"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["fraudresults"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full result from the fraud check"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["isfraud"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The details of the fraud check if an error occurs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientdetails"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full details of the client the order is for"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-11","__idx":47},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-11","__idx":48},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('FraudCheckFailed', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fraudcheckpassed","__idx":49},"children":["FraudCheckPassed"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the fraud check passes successfully for a new order."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-12","__idx":50},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the order that has been fraud checked"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ordernumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order number"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the invoice generated on order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["amount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount the order was for"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["fraudresults"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full result from the fraud check"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["isfraud"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The details of the fraud check if an error occurs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientdetails"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full details of the client the order is for"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-12","__idx":51},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-12","__idx":52},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('FraudCheckPassed', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fraudorder","__idx":53},"children":["FraudOrder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Runs when an order is requested to be set as fraud, prior to the change of status actually occurring."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-13","__idx":54},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-13","__idx":55},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-13","__idx":56},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('FraudOrder', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"orderaddonpricingoverride","__idx":57},"children":["OrderAddonPricingOverride"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as an addon price is being calculated in the cart."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-14","__idx":58},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["key"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The key for the product in the cart session"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["pid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The product id"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["addonid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The addon id"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["proddata"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The product data for an addon with new product purchase"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["serviceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The service id when purchasing an addon for existing service"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-14","__idx":59},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Addon pricing can be overridden. Accepts a return of the keys 'setup' and 'recurring'."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-14","__idx":60},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\Service\\Service;\n\nadd_hook('OrderAddonPricingOverride', 1, function($vars) {\n    $return = [];\n    if (array_key_exists('proddata', $vars)) {\n        /**\n         * This is a product and addon purchase\n         */\n        if ($vars['addonid'] == 1 && $vars['proddata']['pid'] == 1) {\n            $return = ['setup' => '1.00', 'recurring' => '5.00',];\n        }\n    } else {\n        /**\n         * This is an addon only purchase for existing service\n         */\n        $serviceData = Service::find($vars['serviceid']);\n        if ($serviceData && $vars['addonid'] == 1 && $serviceData->packageId == 1) {\n            $return = ['setup' => '1.00', 'recurring' => '5.00',];\n        }\n    }\n    return $return;\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"orderdomainpricingoverride","__idx":61},"children":["OrderDomainPricingOverride"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as a domain price is being calculated in the cart."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-15","__idx":62},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Either ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["register"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transfer"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domain"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["regperiod"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The registration period of the domain (in years)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["renewalperiod"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The renewal period of the domain (in years)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["dnsmanagement"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["emailforwarding"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["idprotection"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["eppcode"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Available for transfer only."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["isPremium"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-15","__idx":63},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A float to override the first payment, or an array to override first and/or recurring amounts"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-15","__idx":64},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('OrderDomainPricingOverride', 1, function($vars) {\n    // Perform operations to determine price.\n    // To override the first payment amount only simply return a float\n    return '64.95';\n    // To override the first payment and recurring amount, return an array as follows\n    return ['firstPaymentAmount' => 64.95, 'recurringAmount' => 14.45];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"orderpaid","__idx":65},"children":["OrderPaid"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the first invoice for a new order is marked paid. This will execute in addition to the regular invoice payment hooks."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-16","__idx":66},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderId"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The unique identifier for the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userId"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The unique identifier for the client"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceId"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The unique identifier for the invoice"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-16","__idx":67},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-16","__idx":68},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('OrderPaid', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"orderproductpricingoverride","__idx":69},"children":["OrderProductPricingOverride"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as a product price is being calculated in the cart."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-17","__idx":70},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["key"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The key for the product in the cart session"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["pid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The product id"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["proddata"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The product data"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-17","__idx":71},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Product pricing can be overridden - exclusive of configurable option cost. Accepts a return of the keys 'setup' and 'recurring'. eg: return array('setup' => 1.00, 'recurring' => 12.00);"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-17","__idx":72},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\Authentication\\CurrentUser;\n\nadd_hook('OrderProductPricingOverride', 1, function($vars) {\n    $return = [];\n\n    /**\n     * Get the logged in client. Returns null if no client logged in.\n     *\n     * @see https://developers.whmcs.com/advanced/authentication/\n     */\n    $client = CurrentUser::client();\n\n    /**\n     * Run the following rules if a Client is logged in.\n     */\n    if ($client) {\n        /**\n         * Override the product price when ordering product 1 and the user has the ID 10.\n         */\n        if ($vars['pid'] == 1 && $client->id == 10) {\n            $return = ['setup' => '0.00', 'recurring' => '0.00',];\n        }\n\n        /**\n         * Override the product price when user has the ID 72.\n         */\n        if ($client->id == 72) {\n            $return = ['setup' => '0.00', 'recurring' => '0.00',];\n        }\n    }\n    return $return;\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"orderproductupgradeoverride","__idx":73},"children":["OrderProductUpgradeOverride"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as a product upgrade order is being calculated."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-18","__idx":74},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["oldproductid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["oldproductname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["newproductid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["newproductname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["days"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["totaldays"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["newproductbillingcycle"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["price"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["discount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["promoqualifies"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-18","__idx":75},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return any key -> value pairs of the parameters to override. eg return array('discount' => 10.00,);"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-18","__idx":76},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\Carbon;\n\nadd_hook('OrderProductUpgradeOverride', 1, function($vars) {\n    $return = [];\n\n    if ($vars['newproductid'] == 15) {\n        /**\n         * No promotion should be applied to product 15\n         */\n        $return['promoqualifies'] = false;\n    }\n    if (Carbon::now()->toDateString() == '2016-12-25') {\n        /**\n         * Offer half price upgrade on Christmas Day\n         * This can also be done by halving the $vars['price'] and returning that.\n         */\n        $return['totaldays'] = round($vars['totaldays'] / 2);\n    }\n    return $return;\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overrideordernumbergeneration","__idx":77},"children":["OverrideOrderNumberGeneration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes prior to checkout. All cart information is passed to the hook."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-19","__idx":78},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of product information for each product in the cart."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domains"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of domain information for each domain in the cart."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-19","__idx":79},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return the custom order number to be used (must be a valid numeric value)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-19","__idx":80},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('OverrideOrderNumberGeneration', 1, function($vars) {\n    // Generate and return a custom order number value (must be a valid integer).\n    // We also recommend ensuring the custom number is unique.\n    return time();\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pendingorder","__idx":81},"children":["PendingOrder"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Runs when an order is requested to be set back to pending, prior to the change of status actually occurring."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-20","__idx":82},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order ID"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-20","__idx":83},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-20","__idx":84},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('PendingOrder', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"precalculatecarttotals","__idx":85},"children":["PreCalculateCartTotals"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as the cart totals are being calculated. All cart information is passed to the hook. Examples given here."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-21","__idx":86},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of product information for each product in the cart."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domains"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of domain information for each domain in the cart."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-21","__idx":87},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-21","__idx":88},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('PreCalculateCartTotals', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prefraudcheck","__idx":89},"children":["PreFraudCheck"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-22","__idx":90},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["$params"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-22","__idx":91},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-22","__idx":92},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('PreFraudCheck', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"preshoppingcartcheckout","__idx":93},"children":["PreShoppingCartCheckout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes prior to checkout. All cart information is passed to the hook."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-23","__idx":94},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of product information for each product in the cart."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domains"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An indexed array of domain information for each domain in the cart."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-23","__idx":95},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No response supported"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-23","__idx":96},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('PreShoppingCartCheckout', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"runfraudcheck","__idx":97},"children":["RunFraudCheck"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes as the fraud module is being checked for an order."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-24","__idx":98},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-24","__idx":99},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return any value to skip the fraud check"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-24","__idx":100},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\nadd_hook('RunFraudCheck', 1, function($vars) {\n    // Perform hook code here...\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartcheckoutcompletepage","__idx":101},"children":["ShoppingCartCheckoutCompletePage"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when the Complete Page is displayed on checkout."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-25","__idx":102},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["orderid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ordernumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The order number for the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["invoiceid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The id of the invoice for the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ispaid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["bool"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Indicates whether the order has been paid"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["amount"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["float"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The amount of order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["paymentmethod"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The payment method of the order"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientdetails"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The full details for the client the order is for"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-25","__idx":103},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return HTML to be displayed on the order complete page."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-25","__idx":104},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) {\n    /**\n     * Redirect all orders to a different page after the order complete page is loaded.\n     */\n    return '<META http-equiv=\"refresh\" content=\"5;URL=http://www.mydomain.com/ownpage.html\" />';\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartvalidatecheckout","__idx":105},"children":["ShoppingCartValidateCheckout"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes during checkout completion, which occurs before order and invoice creation. Use this to"," ","prevent order creation and present errors to the user."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-26","__idx":106},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["a"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value will be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkout"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["submit"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value will be true."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["promocode"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["If entered, a promotion code."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["notes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["If enabled, additional order notes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["paymentmethod"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The selected payment method"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ccinfo"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Either ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["new"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["useexisting"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["cctype"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ccnumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ccexpirymonth"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ccexpiryyear"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["cccvv"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["custtype"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Possible values are ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["new"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["existing"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["clientId"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A non-zero value if the user is authenticated during checkout."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["loginemail"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present only when the client authenticates during checkout."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["loginpassword"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present only when the client authenticates during checkout."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["firstname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when the client is new."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["lastname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when the client is new."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["companyname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["email"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["address1"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["address2"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["city"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["state"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["country"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new; two letter ISO code"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["tax_id"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The client's tax ID"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["phonenumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["password"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["password2"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["securityqid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["securityqans"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["customfield"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Value present when client is new"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-26","__idx":107},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return accepts both a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]},". Use a string for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]}," error message or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]}," of strings for multiple error messages."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-26","__idx":108},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('ShoppingCartValidateCheckout', 1, function($vars) {\n    return [\n        'Error message feedback error 1',\n        'Error message feedback error 2',\n    ];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartvalidatedomain","__idx":109},"children":["ShoppingCartValidateDomain"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when Cart Domain Validation is occurring"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-27","__idx":110},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["domainoption"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["sld"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["eg whmcs in whmcs.com"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["tld"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["eg com in whmcs.com"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-27","__idx":111},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return any validation errors. eg: return array('error1', 'error2',);"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-27","__idx":112},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('ShoppingCartValidateDomain', 1, function($vars) {\n    return [\n        'Error message feedback error 1',\n        'Error message feedback error 2',\n    ];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartvalidatedomainsconfig","__idx":113},"children":["ShoppingCartValidateDomainsConfig"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when Domain Update is occurring"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-28","__idx":114},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["N/A"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The REQUEST variables"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-28","__idx":115},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return accepts both a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]},". Use a string for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]}," error message or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]}," of strings for multiple error messages."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-28","__idx":116},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('ShoppingCartValidateDomainsConfig', 1, function($vars) {\n    return [\n        'Error message feedback error 1',\n        'Error message feedback error 2',\n    ];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartvalidateproductupdate","__idx":117},"children":["ShoppingCartValidateProductUpdate"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes when Product Update is occurring"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-29","__idx":118},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["N/A"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The REQUEST variables"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-29","__idx":119},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Return accepts both a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]},". Use a string for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["single"]}," error message or an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]}," of strings for multiple error messages."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-29","__idx":120},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nadd_hook('ShoppingCartValidateProductUpdate', 1, function($vars) {\n    return [\n        'Error message feedback error 1',\n        'Error message feedback error 2',\n    ];\n});\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"shoppingcartvalidateupgrade","__idx":121},"children":["ShoppingCartValidateUpgrade"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Executes during an upgrade/downgrade request to validate resource limits."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-30","__idx":122},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Variable"},"children":["Variable"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["id"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ID of the existing hosting service"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["pid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ID of the target product for upgrade"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"response-30","__idx":123},"children":["Response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An array of error messages. Return an empty array to allow the upgrade."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-code-30","__idx":124},"children":["Example Code"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<?php\n\nuse WHMCS\\Service\\Service;\nuse WHMCS\\Product\\Product;\n\nHook::add('ShoppingCartValidateUpgrade', 1, function($vars) {\n    try {\n        $actualHosting = Service::findOrFail($vars['id']);\n        $requestedUpgrade = Product::findOrFail($vars['pid']);\n\n        if ($requestedUpgrade->overageDiskLimit == 0 && $requestedUpgrade->overageBandwidthLimit == 0) {\n            return [];\n        }\n\n        if (\n            $actualHosting->diskUsage > $requestedUpgrade->overageDiskLimit\n            || $actualHosting->bandwidthUsage > $requestedUpgrade->overageBandwidthLimit\n        ) {\n            return [\n                'Your current disk or bandwidth usage exceeds the limits of the chosen product. <br /><br />Please reduce usage or select a higher plan.',\n            ];\n        }\n        return [];\n    } catch (\\Exception $e) {\n        return [\n            'Error message feedback error 1',\n            'Error message feedback error 2',\n        ];\n    }\n});\n"},"children":[]}]},"headings":[{"value":"Shopping Cart","id":"shopping-cart","depth":1},{"value":"AcceptOrder","id":"acceptorder","depth":2},{"value":"Parameters","id":"parameters","depth":4},{"value":"Response","id":"response","depth":4},{"value":"Example Code","id":"example-code","depth":4},{"value":"AddonFraud","id":"addonfraud","depth":2},{"value":"Parameters","id":"parameters-1","depth":4},{"value":"Response","id":"response-1","depth":4},{"value":"Example Code","id":"example-code-1","depth":4},{"value":"AfterCalculateCartTotals","id":"aftercalculatecarttotals","depth":2},{"value":"Parameters","id":"parameters-2","depth":4},{"value":"Response","id":"response-2","depth":4},{"value":"Example Code","id":"example-code-2","depth":4},{"value":"AfterFraudCheck","id":"afterfraudcheck","depth":2},{"value":"Parameters","id":"parameters-3","depth":4},{"value":"Response","id":"response-3","depth":4},{"value":"Example Code","id":"example-code-3","depth":4},{"value":"AfterShoppingCartCheckout","id":"aftershoppingcartcheckout","depth":2},{"value":"Parameters","id":"parameters-4","depth":4},{"value":"Response","id":"response-4","depth":4},{"value":"Example Code","id":"example-code-4","depth":4},{"value":"CancelOrder","id":"cancelorder","depth":2},{"value":"Parameters","id":"parameters-5","depth":4},{"value":"Response","id":"response-5","depth":4},{"value":"Example Code","id":"example-code-5","depth":4},{"value":"CartItemsTax","id":"cartitemstax","depth":2},{"value":"Parameters","id":"parameters-6","depth":4},{"value":"Response","id":"response-6","depth":4},{"value":"Example Code","id":"example-code-6","depth":4},{"value":"CartSubdomainValidation","id":"cartsubdomainvalidation","depth":2},{"value":"Parameters","id":"parameters-7","depth":4},{"value":"Response","id":"response-7","depth":4},{"value":"Example Code","id":"example-code-7","depth":4},{"value":"CartTotalAdjustment","id":"carttotaladjustment","depth":2},{"value":"Parameters","id":"parameters-8","depth":4},{"value":"Response","id":"response-8","depth":4},{"value":"Example Code","id":"example-code-8","depth":4},{"value":"DeleteOrder","id":"deleteorder","depth":2},{"value":"Parameters","id":"parameters-9","depth":4},{"value":"Response","id":"response-9","depth":4},{"value":"Example Code","id":"example-code-9","depth":4},{"value":"FraudCheckAwaitingUserInput","id":"fraudcheckawaitinguserinput","depth":2},{"value":"Parameters","id":"parameters-10","depth":4},{"value":"Response","id":"response-10","depth":4},{"value":"Example Code","id":"example-code-10","depth":4},{"value":"FraudCheckFailed","id":"fraudcheckfailed","depth":2},{"value":"Parameters","id":"parameters-11","depth":4},{"value":"Response","id":"response-11","depth":4},{"value":"Example Code","id":"example-code-11","depth":4},{"value":"FraudCheckPassed","id":"fraudcheckpassed","depth":2},{"value":"Parameters","id":"parameters-12","depth":4},{"value":"Response","id":"response-12","depth":4},{"value":"Example Code","id":"example-code-12","depth":4},{"value":"FraudOrder","id":"fraudorder","depth":2},{"value":"Parameters","id":"parameters-13","depth":4},{"value":"Response","id":"response-13","depth":4},{"value":"Example Code","id":"example-code-13","depth":4},{"value":"OrderAddonPricingOverride","id":"orderaddonpricingoverride","depth":2},{"value":"Parameters","id":"parameters-14","depth":4},{"value":"Response","id":"response-14","depth":4},{"value":"Example Code","id":"example-code-14","depth":4},{"value":"OrderDomainPricingOverride","id":"orderdomainpricingoverride","depth":2},{"value":"Parameters","id":"parameters-15","depth":4},{"value":"Response","id":"response-15","depth":4},{"value":"Example Code","id":"example-code-15","depth":4},{"value":"OrderPaid","id":"orderpaid","depth":2},{"value":"Parameters","id":"parameters-16","depth":4},{"value":"Response","id":"response-16","depth":4},{"value":"Example Code","id":"example-code-16","depth":4},{"value":"OrderProductPricingOverride","id":"orderproductpricingoverride","depth":2},{"value":"Parameters","id":"parameters-17","depth":4},{"value":"Response","id":"response-17","depth":4},{"value":"Example Code","id":"example-code-17","depth":4},{"value":"OrderProductUpgradeOverride","id":"orderproductupgradeoverride","depth":2},{"value":"Parameters","id":"parameters-18","depth":4},{"value":"Response","id":"response-18","depth":4},{"value":"Example Code","id":"example-code-18","depth":4},{"value":"OverrideOrderNumberGeneration","id":"overrideordernumbergeneration","depth":2},{"value":"Parameters","id":"parameters-19","depth":4},{"value":"Response","id":"response-19","depth":4},{"value":"Example Code","id":"example-code-19","depth":4},{"value":"PendingOrder","id":"pendingorder","depth":2},{"value":"Parameters","id":"parameters-20","depth":4},{"value":"Response","id":"response-20","depth":4},{"value":"Example Code","id":"example-code-20","depth":4},{"value":"PreCalculateCartTotals","id":"precalculatecarttotals","depth":2},{"value":"Parameters","id":"parameters-21","depth":4},{"value":"Response","id":"response-21","depth":4},{"value":"Example Code","id":"example-code-21","depth":4},{"value":"PreFraudCheck","id":"prefraudcheck","depth":2},{"value":"Parameters","id":"parameters-22","depth":4},{"value":"Response","id":"response-22","depth":4},{"value":"Example Code","id":"example-code-22","depth":4},{"value":"PreShoppingCartCheckout","id":"preshoppingcartcheckout","depth":2},{"value":"Parameters","id":"parameters-23","depth":4},{"value":"Response","id":"response-23","depth":4},{"value":"Example Code","id":"example-code-23","depth":4},{"value":"RunFraudCheck","id":"runfraudcheck","depth":2},{"value":"Parameters","id":"parameters-24","depth":4},{"value":"Response","id":"response-24","depth":4},{"value":"Example Code","id":"example-code-24","depth":4},{"value":"ShoppingCartCheckoutCompletePage","id":"shoppingcartcheckoutcompletepage","depth":2},{"value":"Parameters","id":"parameters-25","depth":4},{"value":"Response","id":"response-25","depth":4},{"value":"Example Code","id":"example-code-25","depth":4},{"value":"ShoppingCartValidateCheckout","id":"shoppingcartvalidatecheckout","depth":2},{"value":"Parameters","id":"parameters-26","depth":4},{"value":"Response","id":"response-26","depth":4},{"value":"Example Code","id":"example-code-26","depth":4},{"value":"ShoppingCartValidateDomain","id":"shoppingcartvalidatedomain","depth":2},{"value":"Parameters","id":"parameters-27","depth":4},{"value":"Response","id":"response-27","depth":4},{"value":"Example Code","id":"example-code-27","depth":4},{"value":"ShoppingCartValidateDomainsConfig","id":"shoppingcartvalidatedomainsconfig","depth":2},{"value":"Parameters","id":"parameters-28","depth":4},{"value":"Response","id":"response-28","depth":4},{"value":"Example Code","id":"example-code-28","depth":4},{"value":"ShoppingCartValidateProductUpdate","id":"shoppingcartvalidateproductupdate","depth":2},{"value":"Parameters","id":"parameters-29","depth":4},{"value":"Response","id":"response-29","depth":4},{"value":"Example Code","id":"example-code-29","depth":4},{"value":"ShoppingCartValidateUpgrade","id":"shoppingcartvalidateupgrade","depth":2},{"value":"Parameters","id":"parameters-30","depth":4},{"value":"Response","id":"response-30","depth":4},{"value":"Example Code","id":"example-code-30","depth":4}],"frontmatter":{"title":"Shopping Cart","seo":{"title":"Shopping Cart"}},"lastModified":"2026-08-04T14:47:26.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/hooks-reference/shopping-cart","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}