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.

Method of the class: ReportsSync{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = ReportsSync::clear_stock_count_cache( $id );
$id(int) (required)
Post/product ID.

ReportsSync::clear_stock_count_cache() code WC 8.6.1

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 );
	}
}