Automattic\WooCommerce\Caches

ProductCountCache::set_multiple │ public │ WC 1.0

Устарела с версии 11.1.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Set the cache count value for multiple statuses at once.

Метод класса: ProductCountCache{}

Хуков нет.

Возвращает

array<string,bool>.

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

$ProductCountCache = new ProductCountCache();
$ProductCountCache->set_multiple( $product_type, $counts );
$product_type(строка) (обязательный)
The post type (e.g. 'product', 'product_variation').
$counts(array<string,int>) (обязательный)
Counts keyed by status slug (e.g. [ 'publish' => 10, 'draft' => 5 ]).

Список изменений

Устарела с 11.1.0

Код ProductCountCache::set_multiple() WC 11.2.2

public function set_multiple( string $product_type, array $counts ) {
	$results = array();
	foreach ( $counts as $status => $count ) {
		$results[ $this->get_cache_key( $product_type, (string) $status ) ] = $this->set( $product_type, (string) $status, (int) $count );
	}

	return $results;
}