WC_Order_Data_Store_CPT::get_order_count()
Return count of orders with a specific status.
Method of the class: WC_Order_Data_Store_CPT{}
No Hooks.
Return
Int
.
Usage
$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.
WC_Order_Data_Store_CPT::get_order_count() WC Order Data Store CPT::get order count code WC 9.3.3
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 ) ) ); }