WordPress at Your Fingertips
function is not described


DataStore::get_count() private WC 1.0

Get count for the passed in stock status.

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

No Hooks.


Int. Count.


// private - for code of main (parent) class only
$result = $this->get_count( $status );
$status(string) (required)
Status slug.

Code of DataStore::get_count() WC 6.1.0

private function get_count( $status ) {
	global $wpdb;

	return (int) $wpdb->get_var(
			SELECT count( DISTINCT posts.ID ) FROM {$wpdb->posts} posts
			LEFT JOIN {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup ON posts.ID = wc_product_meta_lookup.product_id
			WHERE posts.post_type IN ( 'product', 'product_variation' )
			AND wc_product_meta_lookup.stock_status = %s