WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\Features

ActivityPanels::has_low_stock_products() public WC 1.0

Determines if there are out of stock or low stock products.

{} Это метод класса: ActivityPanels{}

Хуков нет.

Возвращает

true/false.

Использование

$ActivityPanels = new ActivityPanels();
$ActivityPanels->has_low_stock_products();

Код ActivityPanels::has_low_stock_products() WC 4.7.1

<?php
public function has_low_stock_products() {
	global $wpdb;

	// Bail early if store does not manage stock, or Woo version < 3.6 needs lookup tables.
	if (
		'yes' !== get_option( 'woocommerce_manage_stock' ) ||
		version_compare( get_option( 'woocommerce_db_version', null ), '3.6', '<' )
	) {
		return false;
	}

	$low_stock_out_of_stock_count = get_transient( self::LOW_STOCK_TRANSIENT_NAME );

	if ( false === $low_stock_out_of_stock_count ) {
		$low_stock_out_of_stock_count = (int) $wpdb->get_var(
			"SELECT COUNT( product_id )
			FROM {$wpdb->wc_product_meta_lookup} AS lookup
			INNER JOIN {$wpdb->posts} as posts ON lookup.product_id = posts.ID
			WHERE stock_status IN ( 'onbackorder', 'outofstock' )
			AND posts.post_status = 'publish'"
		);
		set_transient( self::LOW_STOCK_TRANSIENT_NAME, $low_stock_out_of_stock_count, HOUR_IN_SECONDS );
	}
	return $low_stock_out_of_stock_count > 0;
}