function hook_commerce_order_status_info in Commerce Core 7
Defines order statuses for use in managing orders.
An order status is a single step in the life-cycle of an order that administrators can use to know at a glance what has occurred to the order already and/or what the next step in processing the order will be.
The Order module defines several order statuses in its own implementation of this hook, commerce_order_commerce_order_status_info():
- Canceled: default status of the Canceled state; used for orders that are marked as canceled via the administrative user interface
- Pending: default status of the Pending state; used to indicate the order has completed checkout and is awaiting further action before being considered complete
- Processing: additional status for the Pending state; used to indicate orders that have begun to be processed but are not yet completed
- Completed: default status of the Completed state; used for orders that don’t require any further attention or customer interaction
The Cart and Checkout modules also define order statuses and interact with them in special ways. The Cart module actually uses the order status to identify an order as a user’s shopping cart order based on the special 'cart' property of order statuses.
The Checkout module uses the order status to determine which page of the checkout process a customer is currently on when they go to the checkout URL. As the order progresses through checkout, the order status is updated to reflect the new page. The statuses defined for these things are as follows:
- Shopping cart: default status of the Shopping cart state; used for orders that are pure shopping cart orders that have not begun the checkout process at all.
- Checkout: [page name]: each checkout page has a related order status containing the name of the checkout page the order has progressed to; orders in this status are either in checkout or have been abandoned at the indicated step of the checkout process
The order status array structure is as follows:
- name: machine-name identifying the order status using lowercase alphanumeric characters, -, and _
- title: the translatable title of the order status, used in administrative interfaces
- state: the name of the order state the order status belongs to
- cart: TRUE or FALSE indicating whether or not orders with this status should be considered shopping cart orders
- weight: integer weight of the status used for sorting lists of order statuses; defaults to 0
- status: TRUE or FALSE indicating the enabled status of this order status, with disabled statuses not being available for use; defaults to TRUE
Return value
An array of order status arrays keyed by name.
3 functions implement hook_commerce_order_status_info()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- commerce_cart_commerce_order_status_info in modules/
cart/ commerce_cart.module - Implements hook_commerce_order_status_info().
- commerce_checkout_commerce_order_status_info in modules/
checkout/ commerce_checkout.module - Implements hook_commerce_order_status_info().
- commerce_order_commerce_order_status_info in modules/
order/ commerce_order.module - Implements hook_commerce_order_status_info().
1 invocation of hook_commerce_order_status_info()
- commerce_order_statuses in modules/
order/ commerce_order.module - Returns an array of some or all of the order statuses keyed by name.
File
- modules/
order/ commerce_order.api.php, line 122 - Hooks provided by the Order module.
Code
function hook_commerce_order_status_info() {
$order_statuses = array();
$order_statuses['completed'] = array(
'name' => 'completed',
'title' => t('Completed'),
'state' => 'completed',
);
return $order_statuses;
}