> $tools WooCommerce debug tools, keyed by tool ID. * @return array> */ public function annotateTools( array $tools ): array { $archived = $this->archive->count(); if ( 0 === $archived ) { return $tools; } foreach ( array( 'clear_woocommerce_analytics_cache', 'delete_analytics_data_and_resync' ) as $key ) { if ( ! isset( $tools[ $key ] ) ) { continue; } $warning = sprintf( /* translators: %s: number of archived orders. */ __( 'Warning: %s archived orders are not in the live order tables. Regenerating will remove them from all reports. Restore them first: WooCommerce → Coldstash → Archived orders → Restore all.', 'coldstash' ), number_format_i18n( $archived ) ); $tools[ $key ]['desc'] = ( $tools[ $key ]['desc'] ?? '' ) . '
' . esc_html( $warning ) . ''; } return $tools; } /** * Shows a notice on WooCommerce → Status while orders are archived. */ public function maybeWarn(): void { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || ! str_contains( (string) $screen->id, 'wc-status' ) ) { return; } $archived = $this->archive->count(); if ( 0 === $archived ) { return; } printf( '

%s

', esc_html( sprintf( /* translators: %s: number of archived orders. */ __( 'Coldstash: %s orders are archived. Analytics reports still include them — but regenerating Analytics data will not.', 'coldstash' ), number_format_i18n( $archived ) ) ) ); } }