Commit 3757b0e2190 for woocommerce
commit 3757b0e21908afd348fccc6d192c55b74b306a95
Author: James Kemp <me@jckemp.com>
Date: Wed Mar 11 08:06:00 2026 +0000
Fix template override status reporting and render as individual rows (#63460)
* Fix outdated templates flag to distinguish missing version headers
Templates with missing @version headers were incorrectly flagged as
outdated in both the status report HTML and the REST API controller.
Update the status report to render three distinct states: missing
version header, truly outdated, and up to date. Align the controller's
has_outdated_templates flag to only trigger for genuinely outdated
templates (version exists AND is less than core).
* Clean up outdated templates text export in system status report
Rename label from "Outdated Templates" to "Templates up to date" so the
warning icon reads clearly as "not up to date" rather than the ambiguous
"no outdated templates". Wrap action links in a .private span so they
are excluded from the plain-text system report export.
* Add changefile(s) from automation for the following project(s): woocommerce
* Revert label change for outdated templates row
The "Templates up to date" rename doesn't make sense visually since the
row only appears when templates are NOT up to date. Revert to the
original "Outdated templates" label.
* Use strict empty-string checks for template override versions
Replace empty() with strict '' === comparison for override version
checks. In PHP, empty('0') returns true, so a version string of '0'
would be incorrectly treated as a missing version header.
* Render template overrides as individual rows in system status report
Replace the comma-separated list of template overrides with individual
table rows for better readability. Each override gets its own row with
the file path in the value column and status details on a second line
using the existing mark/dashicon error pattern.
Move the "Templates up to date" summary row into a tfoot element for
visual separation from the override list.
Update the text export to include tfoot content and output blank lines
for empty rows instead of orphaned colons.
* Add changefile(s) from automation for the following project(s): woocommerce
* Remove tfoot from text export selector
The Outdated templates row lives in tfoot and does not need to appear
in the plain-text system status report.
* Remove unused data-export-label from outdated templates tfoot row
The tfoot is excluded from the text export selector, so the attribute
is never read.
---------
Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
Co-authored-by: Panos (Panagiotis Synetos) <2484390+PanosSynetos@users.noreply.github.com>
diff --git a/plugins/woocommerce/changelog/63460-fix-template-override-status b/plugins/woocommerce/changelog/63460-fix-template-override-status
new file mode 100644
index 00000000000..37391298595
--- /dev/null
+++ b/plugins/woocommerce/changelog/63460-fix-template-override-status
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix template overrides with missing version headers being incorrectly flagged as outdated, and render overrides as individual rows in the System Status report for improved readability.
\ No newline at end of file
diff --git a/plugins/woocommerce/client/legacy/js/admin/system-status.js b/plugins/woocommerce/client/legacy/js/admin/system-status.js
index 51255ea4e7c..4ef81430487 100644
--- a/plugins/woocommerce/client/legacy/js/admin/system-status.js
+++ b/plugins/woocommerce/client/legacy/js/admin/system-status.js
@@ -66,7 +66,11 @@ jQuery( function ( $ ) {
the_value = temp_line;
}
- report = report + '' + the_name + ': ' + the_value + '\n';
+ if ( the_name || the_value ) {
+ report = report + '' + the_name + ': ' + the_value + '\n';
+ } else {
+ report = report + '\n';
+ }
});
}
});
diff --git a/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php b/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php
index 39636d36cb0..25963515448 100644
--- a/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php
+++ b/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php
@@ -1048,35 +1048,39 @@ if ( 0 < $mu_plugins_count ) :
</tr>
<?php endif ?>
<?php if ( ! empty( $theme['overrides'] ) ) : ?>
+ <?php foreach ( $theme['overrides'] as $i => $override ) : ?>
<tr>
- <td data-export-label="Overrides"><?php esc_html_e( 'Overrides', 'woocommerce' ); ?></td>
- <td class="help"> </td>
- <td>
- <?php
- $total_overrides = is_countable( $theme['overrides'] ) ? count( $theme['overrides'] ) : 0;
- for ( $i = 0; $i < $total_overrides; $i++ ) {
- $override = $theme['overrides'][ $i ];
- if ( $override['core_version'] && ( empty( $override['version'] ) || version_compare( $override['version'], $override['core_version'], '<' ) ) ) {
- $current_version = $override['version'] ? $override['version'] : '-';
- printf(
- /* Translators: %1$s: Template name, %2$s: Template version, %3$s: Core version. */
- esc_html__( '%1$s version %2$s is out of date. The core version is %3$s', 'woocommerce' ),
- '<code>' . esc_html( $override['file'] ) . '</code>',
- '<strong style="color:red">' . esc_html( $current_version ) . '</strong>',
- esc_html( $override['core_version'] )
- );
- } else {
- echo esc_html( $override['file'] );
- }
-
- if ( ( $total_overrides - 1 ) !== $i ) {
- echo ', ';
- }
- echo '<br />';
- }
- ?>
+ <td data-export-label="Override">
+ <?php if ( 0 === $i ) : ?>
+ <?php esc_html_e( 'Overrides', 'woocommerce' ); ?>:
+ <?php endif; ?>
</td>
+ <td class="help"> </td>
+ <?php
+ echo '<td>';
+ echo '<code>' . esc_html( $override['file'] ) . '</code>';
+ if ( $override['core_version'] && '' === $override['version'] ) {
+ echo ' <br><mark class="error"><span class="dashicons dashicons-warning"></span> ';
+ printf(
+ /* Translators: %s: Core version. */
+ esc_html__( 'Version header is missing. The core version is %s', 'woocommerce' ),
+ '<strong>' . esc_html( $override['core_version'] ) . '</strong>'
+ );
+ echo '</mark>';
+ } elseif ( $override['core_version'] && version_compare( $override['version'], $override['core_version'], '<' ) ) {
+ echo ' <br><mark class="error"><span class="dashicons dashicons-warning"></span> ';
+ printf(
+ /* Translators: %1$s: Template version, %2$s: Core version. */
+ esc_html__( 'Version %1$s is out of date. The core version is %2$s', 'woocommerce' ),
+ '<strong>' . esc_html( $override['version'] ) . '</strong>',
+ '<strong>' . esc_html( $override['core_version'] ) . '</strong>'
+ );
+ echo '</mark>';
+ }
+ echo '</td>';
+ ?>
</tr>
+ <?php endforeach; ?>
<?php else : ?>
<tr>
<td data-export-label="Overrides"><?php esc_html_e( 'Overrides', 'woocommerce' ); ?>:</td>
@@ -1084,15 +1088,17 @@ if ( 0 < $mu_plugins_count ) :
<td>–</td>
</tr>
<?php endif; ?>
-
- <?php if ( true === $theme['has_outdated_templates'] ) : ?>
- <tr>
- <td data-export-label="Outdated Templates"><?php esc_html_e( 'Outdated templates', 'woocommerce' ); ?>:</td>
- <td class="help"> </td>
- <td>
- <mark class="error">
- <span class="dashicons dashicons-warning"></span>
- </mark>
+ </tbody>
+ <?php if ( true === $theme['has_outdated_templates'] ) : ?>
+ <tfoot>
+ <tr>
+ <td><?php esc_html_e( 'Outdated templates', 'woocommerce' ); ?>:</td>
+ <td class="help"> </td>
+ <td>
+ <mark class="error">
+ <span class="dashicons dashicons-warning"></span>
+ </mark>
+ <span class="private">
<a href="https://developer.woocommerce.com/docs/theming/theme-development/fixing-outdated-woocommerce-templates/" target="_blank">
<?php esc_html_e( 'Learn how to update', 'woocommerce' ); ?>
</a> |
@@ -1102,10 +1108,11 @@ if ( 0 < $mu_plugins_count ) :
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-status&tab=tools' ) ); ?>">
<?php esc_html_e( 'Clear system status theme info cache', 'woocommerce' ); ?>
</a>
- </td>
- </tr>
- <?php endif; ?>
- </tbody>
+ </span>
+ </td>
+ </tr>
+ </tfoot>
+ <?php endif; ?>
</table>
<?php
diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php
index f5a1c3499d6..917ade52781 100644
--- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php
+++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php
@@ -1389,7 +1389,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
$core_version = WC_Admin_Status::get_file_version( WC()->plugin_path() . '/templates/' . $core_file );
$override_version = WC_Admin_Status::get_file_version( $override_file );
- if ( $core_version && ( empty( $override_version ) || version_compare( $override_version, $core_version, '<' ) ) ) {
+ if ( $core_version && '' !== $override_version && version_compare( $override_version, $core_version, '<' ) ) {
if ( ! $outdated_templates ) {
$outdated_templates = true;
}