Ubercart: How to update a variable on payment received or status completed
Ubercart: How to update a variable on payment received or status completed
I have ubercart 2 installed and I want to update a variable once the order has been paid (this means the order status is changed to complete or payment received. What is the best way of doing that in the code? What hook?
Hook_order is the solution
You are looking for following piece of code for sure:
<php>
function hook_order($op, $order, $status) {
switch ($op) {
case 'update':
if (($order->uid > 0) && ($order_user = user_load(array('uid' => $order->uid))) !== FALSE && ($status == 'completed' || $status == 'payment_received')) {
// your code here
break;
}
}
}
</php>
Read »Category: Tags: