WordPress at Your Fingertips
function is not described

WC_Order_Data_Store_CPT::get_order_count() public WC 1.0

Return count of orders with a specific status.

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

No Hooks.




$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->get_order_count( $status );
$status(string) (required)
Order status. Function wc_get_order_statuses() returns a list of valid statuses.

Code of WC_Order_Data_Store_CPT::get_order_count() WC 5.6.0

public function get_order_count( $status ) {
	global $wpdb;
	return absint( $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( * ) FROM {$wpdb->posts} WHERE post_type = 'shop_order' AND post_status = %s", $status ) ) );