webtechwhiz Posted April 22, 2021 Share Posted April 22, 2021 Dear Team, In reply to a support ticket #KQX-559385 - How to set invoice number raised on 13/01/2021 support team member John Kipling has given AfterShoppingCartCheckout hook on 21st April 2021. Based on documentation I had written hook code as below: function generate_custom_invoice_number_4Client_hook($vars) { $invoiceid = $vars['InvoiceID']; $customnumber = 'WTW'.date("Y").str_pad($invoiceid,5,"0",STR_PAD_LEFT); if (isset($customnumber)) { try { $updatedInvoiceNumber = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->update(['invoicenum' => $customnumber,]); } catch (\Exception $e) { // Deal with error } } } add_hook('AfterShoppingCartCheckout', 1, "generate_custom_invoice_number_4Client_hook"); But its not working. As given in hook documentation below parameters should be available: Parameters Variable Type Notes OrderID int The Order ID OrderNumber int The randomly generated order number ServiceIDs array An array of Service IDs created by the order AddonIDs array An array of Addon IDs created by the order DomainIDs array An array of Domain IDs created by the order RenewalIDs array An array of Domain Renewal IDs created by the order PaymentMethod string The payment gateway selected InvoiceID int The Invoice ID TotalDue float The total amount due Hence I have fetched InvoiceId as $invoiceid = $vars['InvoiceID']. But not working. Request community members to help me in formatting invoice number with hook AfterShoppingCartCheckout. Unable to find any post related to AfterShoppingCartCheckout which is used to format invoice number. Request to kindly approve this topic. Regards, Shubhajeet Saha 0 Quote Link to comment Share on other sites More sharing options...
webtechwhiz Posted April 27, 2021 Author Share Posted April 27, 2021 (edited) Find enclosed activity log for hook AfterShoppingCartCheckout Awaiting solution/reply from Developers in WHMCS community . . . Edited April 27, 2021 by webtechwhiz For attachment 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.