Function uc_cart_complete_sale() in uc_cart.module:
($order, $login = FALSE)


This function is utilized by the default checkout system and can be used by third party checkout integration modules to complete a sale. An order that is being checked out is tagged with an In Checkout order status. This function moves that order to the post checkout status of Pending. It is also responsible for creating the user account for an anonymous user or attaching the order to an existing user account if the e-mail address matches. You can also specify whether or not the function should login a newly created user.

  • $order - the order in progress that is being completed
  • $login - hether or not to login a new user when this function is called
Return value:
A string containing the checkout message specified in the settings. Your module can display this as the confirmation message or disregard it altogether if you want to do something else.

// From uc_cart_checkout_complete().
$output = uc_cart_complete_sale($order, variable_get('uc_new_customer_login', FALSE));


// Add a comment to let sales team know this came in through the site.
uc_order_comment_save($order->order_id, 0, 'Order created through website.', 'admin');


// Empty that cart...