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.
Метод класса: ReportsSync{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = ReportsSync::clear_stock_count_cache( $id );
- $id(int) (обязательный)
- Post/product ID.
Код ReportsSync::clear_stock_count_cache() ReportsSync::clear stock count cache WC 10.8.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 );
}
}