Automattic\WooCommerce\Admin
ReportsSync::clear_stock_count_cache()
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.
Usage
$result = ReportsSync::clear_stock_count_cache( $id );
- $id(int) (required)
- Post/product ID.
ReportsSync::clear_stock_count_cache() ReportsSync::clear stock count cache code WC 7.5.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 ); } }