Filter: tcp get order status

Description

“tcp_get_order_status” allows to add or change completely the list of order status in TheCartPress.

Parameters

$status_list
(Array) List of order status with the next format: array( name => array( ‘name’, ‘label’, ‘show_in_dashboard’, ‘valid_for_deleting’, “is_canceled’, ‘is_completed’), ).

name

Identifier of the order status

label

Label of the order status. This value is displayed in the selection lists.

show_in_dashboard

If true, The orders summary panel, in the dashboard, displays the orders with this status.

valid_for_deleting

If true, the order with this status will be able to be deleted.

is_canceled

if true, the status is the canceled status. This value is used by the payment plugins.

is_completed

if true, the status is the completed status. This value is used by the payment plugins.

Examples

Adding more status

<?php
function my_tcp_get_order_status( $status_list ) {
	$status_list['waiting'] = array(
		'name'			=> 'waiting',
		'label'			=> __( 'Waiting', 'tcp' ),
		'show_in_dashboard'	=> true,
		'valid_for_deleting'	=> false,
	);
	return $status_list;
}
add_filter( 'tcp_get_order_status', 'my_tcp_get_order_status' ); ?>

Changing all states

<?php
function my_tcp_get_order_status( $status_list ) {
	$status_list = array(
		'received' => array(
			'name'		=> 'received',
			'label'		=> __( 'Received,', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> false,
		),
		'processing' => array(
			'name'		=> 'processing',
			'label'		=> __( 'Processing', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> false,
		),
		'booked' => array(
			'name'		=> 'booked',
			'label'		=> __( 'Booked', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> false,
		),
		'waiting' => array(
			'name'		=> 'waiting',
			'label'		=> __( 'Waiting for customer callback', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> false,
		),
		'being_edited' => array(
			'name'	=> 'being_edited',
			'label'		=> __( 'Being edited', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> false,
		),
		'canceled' => array(
			'name'		=> 'canceled',
			'label'		=> __( 'Canceled', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> true,
			'is_canceled'		=> true,
		),
		'completed' => array(
			'name'		=> 'completed',
			'label'		=> __( 'Completed', 'tcp' ),
			'show_in_dashboard'	=> true,
			'valid_for_deleting'	=> true,
			'is_completed'		=> true,
		),
	);
	return $status_list;
}
add_filter( 'tcp_get_order_status', 'my_tcp_get_order_status' ); ?>

Change Log

Since 1.1.1
Since 1.1.2: the $status_list is now a hash table.