System Status compatibility with the classic-shortcode block (#40948)

This commit is contained in:
nigeljamesstevenson 2023-10-26 08:21:42 +01:00 committed by GitHub
commit 822e4cf227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix detection of cart and checkout classic-shortcode blocks in the system status report.

View File

@ -1388,6 +1388,11 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
if ( $values['block'] && get_post( $page_id ) ) {
$block_required = true;
$block_present = WC_Blocks_Utils::has_block_in_page( $page_id, $values['block'] );
// Compatibility with the classic shortcode block which can be used instead of shortcodes.
if ( ! $block_present && ( 'woocommerce/checkout' === $values['block'] || 'woocommerce/cart' === $values['block'] ) ) {
$block_present = WC_Blocks_Utils::has_block_in_page( $page_id, 'woocommerce/classic-shortcode', true );
}
}
// Wrap up our findings into an output array.