diff --git a/src/BlockTypes/Cart.php b/src/BlockTypes/Cart.php index 1888272f32b..d9baf83f9f5 100644 --- a/src/BlockTypes/Cart.php +++ b/src/BlockTypes/Cart.php @@ -98,7 +98,7 @@ protected function render( $attributes, $content, $block ) { * The blocks used for testing should be always available in the block (not removable by the user). */ - $regex_for_filled_cart_block = '//mi'; + $regex_for_filled_cart_block = '/]*?>/mi'; // Filled Cart block was added in i2, so we search for it to see if we have a Cart i1 template. $has_i1_template = ! preg_match( $regex_for_filled_cart_block, $content ); @@ -140,8 +140,8 @@ protected function render( $attributes, $content, $block ) {
'; // Order summary subtotal block was added in i3, so we search for it to see if we have a Cart i2 template. - $regex_for_order_summary_subtotal = '//mi'; - $regex_for_order_summary = '//mi'; + $regex_for_order_summary_subtotal = '/]*?>/mi'; + $regex_for_order_summary = '/]*?>/mi'; $has_i2_template = ! preg_match( $regex_for_order_summary_subtotal, $content ); if ( $has_i2_template ) { diff --git a/src/BlockTypes/Checkout.php b/src/BlockTypes/Checkout.php index 75b15c45abc..107d66b93cc 100644 --- a/src/BlockTypes/Checkout.php +++ b/src/BlockTypes/Checkout.php @@ -143,8 +143,8 @@ protected function render( $attributes, $content, $block ) {
'; // Order summary subtotal block was added in i3, so we search for it to see if we have a Checkout i2 template. - $regex_for_order_summary_subtotal = '//mi'; - $regex_for_order_summary = '//mi'; + $regex_for_order_summary_subtotal = '/]*?>/mi'; + $regex_for_order_summary = '/]*?>/mi'; $has_i2_template = ! preg_match( $regex_for_order_summary_subtotal, $content ); if ( $has_i2_template ) { @@ -155,11 +155,11 @@ protected function render( $attributes, $content, $block ) { * Add the Local Pickup toggle to checkouts missing this forced template. */ $local_pickup_inner_blocks = '
' . PHP_EOL . PHP_EOL . '
' . PHP_EOL . PHP_EOL . '$0'; - $has_local_pickup_regex = '//mi'; + $has_local_pickup_regex = '/]*?>/mi'; $has_local_pickup = preg_match( $has_local_pickup_regex, $content ); if ( ! $has_local_pickup ) { - $shipping_address_block_regex = '/<\/div>/mi'; + $shipping_address_block_regex = '/]*?><\/div>/mi'; $content = preg_replace( $shipping_address_block_regex, $local_pickup_inner_blocks, $content ); }