Automattic\WooCommerce\Admin

ReportsSync::clear_stock_count_cache()public staticWC 1.0

Clear the count cache when products are added or updated, or when the no/low stock options are changed.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = ReportsSync::clear_stock_count_cache( $id );
$id(int) (обязательный)
Post/product ID.

Код ReportsSync::clear_stock_count_cache() WC 8.7.0

public static function clear_stock_count_cache( $id ) {
	delete_transient( 'wc_admin_stock_count_lowstock' );
	delete_transient( 'wc_admin_product_count' );
	$status_options = wc_get_product_stock_status_options();
	foreach ( $status_options as $status => $label ) {
		delete_transient( 'wc_admin_stock_count_' . $status );
	}
}