diff --git a/src/Templates/SingleProductTemplateCompatibility.php b/src/Templates/SingleProductTemplateCompatibility.php index 124dab0709d..7274985ba9c 100644 --- a/src/Templates/SingleProductTemplateCompatibility.php +++ b/src/Templates/SingleProductTemplateCompatibility.php @@ -55,8 +55,6 @@ function( $hook ) use ( $block_name ) { * Since that there is a custom logic for the first and last block, we have to inject the hooks manually. * The first block supports the following hooks: * woocommerce_before_single_product - * woocommerce_before_single_product_summary - * woocommerce_single_product_summary * * The last block supports the following hooks: * woocommerce_after_single_product @@ -71,7 +69,6 @@ private function inject_hook_to_first_and_last_blocks( $block_content, $block, $ 'before' => array( 'woocommerce_before_main_content' => $this->hook_data['woocommerce_before_main_content'], 'woocommerce_before_single_product' => $this->hook_data['woocommerce_before_single_product'], - 'woocommerce_before_single_product_summary' => $this->hook_data['woocommerce_before_single_product_summary'], ), 'after' => array(), ); @@ -198,7 +195,7 @@ protected function set_hook_data() { ), ), 'woocommerce_before_single_product_summary' => array( - 'block_names' => array(), + 'block_names' => array( 'core/post-excerpt' ), 'position' => 'before', 'hooked' => array( 'woocommerce_show_product_sale_flash' => 10, diff --git a/tests/e2e/tests/single-product-template/single-product-template-compatibility-layer.spec.ts b/tests/e2e/tests/single-product-template/single-product-template-compatibility-layer.spec.ts index 7eedcd20af2..32d3097be14 100644 --- a/tests/e2e/tests/single-product-template/single-product-template-compatibility-layer.spec.ts +++ b/tests/e2e/tests/single-product-template/single-product-template-compatibility-layer.spec.ts @@ -19,12 +19,30 @@ type Scenario = { }; const singleOccurranceScenarios: Scenario[] = [ + { + title: 'Before Main Content', + dataTestId: 'woocommerce_before_main_content', + content: 'Hook: woocommerce_before_main_content', + amount: 1, + }, + { + title: 'Sidebar', + dataTestId: 'woocommerce_sidebar', + content: 'Hook: woocommerce_sidebar', + amount: 1, + }, { title: 'Before Single Product', dataTestId: 'woocommerce_before_single_product', content: 'Hook: woocommerce_before_single_product', amount: 1, }, + { + title: 'Before Single Product Summary', + dataTestId: 'woocommerce_before_single_product_summary', + content: 'Hook: woocommerce_before_single_product_summary', + amount: 1, + }, { title: 'Before Add To Cart Button', dataTestId: 'woocommerce_before_add_to_cart_button', @@ -43,6 +61,18 @@ const singleOccurranceScenarios: Scenario[] = [ content: 'Hook: woocommerce_product_meta_start', amount: 1, }, + { + title: 'Product Meta End', + dataTestId: 'woocommerce_product_meta_end', + content: 'Hook: woocommerce_product_meta_end', + amount: 1, + }, + { + title: 'Share', + dataTestId: 'woocommerce_share', + content: 'Hook: woocommerce_share', + amount: 1, + }, { title: 'After Single Product Summary', dataTestId: 'woocommerce_after_single_product_summary',