The Order module uses this hook to gather information on order states defined by enabled modules. An order state is a particular phase in the life-cycle of an order that is comprised of one or more order statuses. In that regard, an order state is little more than a container for order statuses with a default status per state. This is useful for categorizing orders and advancing orders from one state to the next without needing to know the particular status an order will end up in.
The Order modules defines several order states in its own implementation of this hook, commerce_order_commerce_order_state_info():
Additionally, the Cart and Checkout modules define the following order states:
The order state data structure is as follows:
Example order state definition:
<?php $order_states['completed'] = array( 'name' => 'complete', 'title' => t('Completed'), 'description' => t('Orders in this state have been completed as far as the customer is concerned.'), 'weight' => 10, 'default_status' => 'complete', );
// return $order_states //from hook function ?>
Order states may be altered using hook_commerce_order_state_info_alter(&$order_states) before being sorted by weight.
A single order state array is referred to as $order_state. An array of order state arrays keyed by name is referred to as $order_states. The name of an order state is referred to as $name.
The Order module uses this hook to gather information on order statuses defined by enabled modules. 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 modules defines several order statuses in its own implementation of this hook, commerce_order_commerce_order_status_info():
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:
The order status data structure is as follows:
Example order status definition:
<?php $order_statuses['completed'] = array( 'name' => 'completed', 'title' => t('Completed'), 'state' => 'completed', );
// return $order_statuses; // from hook fn ?>
Order statuses may be altered using hook_commerce_order_status_info_alter(&$order_statuses) after default values have been set and before being sorted by weight.
A single order status array is referred to as $order_status. An array of order status arrays keyed by name is referred to as $order_statuses. The name of an order status is referred to as $name.
Found errors? Think you can improve this documentation? edit this page