WordPress at Your Fingertips
function is not described

WC_Tracker::get_order_dates() private WC 1.0

Get last order date.

{} It's a method of the class: WC_Tracker{}

No Hooks.

Return

String.

Usage

$result = WC_Tracker::get_order_dates();

Code of WC_Tracker::get_order_dates() WC 5.9.0

private static function get_order_dates() {
	global $wpdb;

	$min_max = $wpdb->get_row(
		"
		SELECT
			MIN( post_date_gmt ) as 'first', MAX( post_date_gmt ) as 'last'
		FROM {$wpdb->prefix}posts
		WHERE post_type = 'shop_order'
		AND post_status = 'wc-completed'
	",
		ARRAY_A
	);

	if ( is_null( $min_max ) ) {
		$min_max = array(
			'first' => '-',
			'last'  => '-',
		);
	}

	$processing_min_max = $wpdb->get_row(
		"
		SELECT
			MIN( post_date_gmt ) as 'processing_first', MAX( post_date_gmt ) as 'processing_last'
		FROM {$wpdb->prefix}posts
		WHERE post_type = 'shop_order'
		AND post_status = 'wc-processing'
	",
		ARRAY_A
	);

	if ( is_null( $processing_min_max ) ) {
		$processing_min_max = array(
			'processing_first' => '-',
			'processing_last'  => '-',
		);
	}

	return array_merge( $min_max, $processing_min_max );
}