Yep, we actually don't do any automatic order status updates on checkout completion or payment receipt. We don't really know what might need to be taken into consideration when updating order statuses or what statuses may even be available on a site, so we are purposefully agnostic in core.
The solution here is to use Rules to update the order status using one of two events: "When a customer completes checkout" or "When an order is first paid in full." The important distinction here is that depending on your payment method, it may be possible for a customer to complete checkout without payment. It may be off-line payment, a pending payment, or an asynchronous transaction that simply hasn't POSTed to your site yet.
For those reasons, if you're doing an order status update that triggers fulfillment or completion of an order, you should most likely be using the latter event to ensure the order has been paid in full before processing.
Note: if you prefer a code based solution instead, both of these events have corresponding hooks:
- hook_commerce_checkout_complete()
- hook_commerce_payment_order_paid_in_full()
Comments
Thanks! On a standard site where a transaction is completed after the checkout process when the payment method returns a response, what would be the appropriate action to hook on to in rules?
You'd want to use the When an order is first paid in full event.
Silly question, but where do I put this rule? I can't seem to make it work.
The order status / order state is confusing. In a recent order the "order status" (from store/orders) shows pending. I created a rule with the event "when an order is first paid in full" to change the order status to completed. I created a new order, use payment gateway in test and it didn't change. Then I tried changing order state to completed, again no change.
1. Am I doing something wrong?
2. Will this never change to completed since I'm in a test environment on localhost?
This is driving me batty. thank you, mark