From 84b96bfa3eaf4438ccb65624de0d728d24b4e0a6 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 15 Jun 2020 13:15:31 -0300 Subject: [PATCH] add cache clearing unsupported message --- .../class-wc-rest-system-status-tools-v2-controller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php b/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php index 321a02b688d..9efd82143d3 100644 --- a/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php @@ -578,8 +578,12 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { break; case 'clear_template_cache': - wc_clear_template_cache(); - $message = __( 'Template cache cleared.', 'woocommerce-rest-api' ); + if ( function_exists( 'wc_clear_template_cache' ) ) { + wc_clear_template_cache(); + $message = __( 'Template cache cleared.', 'woocommerce-rest-api' ); + } else { + $message = __( 'The active version of WooCommerce does not support template cache clearing.', 'woocommerce-rest-api' ); + } break; default: