WC_Order_Data_Store_CPT::get_unpaid_orders()publicWC 1.0

Get unpaid orders after a certain date,

Method of the class: WC_Order_Data_Store_CPT{}

No Hooks.

Return

Array.

Usage

$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->get_unpaid_orders( $date );
$date(int) (required)
Timestamp.

WC_Order_Data_Store_CPT::get_unpaid_orders() code WC 9.4.2

public function get_unpaid_orders( $date ) {
	global $wpdb;

	$unpaid_orders = $wpdb->get_col(
		$wpdb->prepare(
		// @codingStandardsIgnoreStart
			"SELECT posts.ID
			FROM {$wpdb->posts} AS posts
			WHERE   posts.post_type   IN ('" . implode( "','", wc_get_order_types() ) . "')
			AND     posts.post_status = 'wc-pending'
			AND     posts.post_modified < %s",
			// @codingStandardsIgnoreEnd
			gmdate( 'Y-m-d H:i:s', absint( $date ) )
		)
	);

	return $unpaid_orders;
}