WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Stock\Stats

DataStore::get_low_stock_count() private WC 1.0

Get low stock count (products with stock < low stock amount, but greater than no stock amount).

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

No Hooks.

Return

Int. Low stock count.

Usage

// private - for code of main (parent) class only
$result = $this->get_low_stock_count();

Code of DataStore::get_low_stock_count() WC 5.3.0

<?php
private function get_low_stock_count() {
	global $wpdb;

	$no_stock_amount  = absint( max( get_option( 'woocommerce_notify_no_stock_amount' ), 0 ) );
	$low_stock_amount = absint( max( get_option( 'woocommerce_notify_low_stock_amount' ), 1 ) );

	return (int) $wpdb->get_var(
		$wpdb->prepare(
			"
			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
			LEFT JOIN {$wpdb->postmeta} low_stock_amount_meta ON posts.ID = low_stock_amount_meta.post_id AND low_stock_amount_meta.meta_key = '_low_stock_amount'
			WHERE posts.post_type IN ( 'product', 'product_variation' )
			AND wc_product_meta_lookup.stock_quantity IS NOT NULL
			AND wc_product_meta_lookup.stock_status = 'instock'
			AND (
				(
					low_stock_amount_meta.meta_value > ''
					AND wc_product_meta_lookup.stock_quantity <= CAST(low_stock_amount_meta.meta_value AS SIGNED)
					AND wc_product_meta_lookup.stock_quantity > %d
				)
				OR (
					(
						low_stock_amount_meta.meta_value IS NULL OR low_stock_amount_meta.meta_value <= ''
					)
					AND wc_product_meta_lookup.stock_quantity <= %d
					AND wc_product_meta_lookup.stock_quantity > %d
				)
			)
			",
			$no_stock_amount,
			$low_stock_amount,
			$no_stock_amount
		)
	);
}