Compatibility Layer: fix 'woocommerce_before_single_product_summary' hook position (#50392)

* Compatibility Layer: fix 'woocommerce_before_single_product_summary' hook position

* Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-08-07 14:53:11 +02:00 committed by GitHub
parent da18c925b9
commit 9ae7485039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -55,7 +55,7 @@ The following table shows where the hooks are injected into the page.
| woocommerce_after_main_content | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after | | woocommerce_after_main_content | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after |
| woocommerce_sidebar | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after | | woocommerce_sidebar | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after |
| woocommerce_before_single_product | First block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | before | | woocommerce_before_single_product | First block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | before |
| woocommerce_before_single_product_summary | First `core/post-excerpt` block (before `woocommerce_single_product_summary`) | before | | woocommerce_before_single_product_summary | First block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | before |
| woocommerce_single_product_summary | First `core/post-excerpt` block | before | | woocommerce_single_product_summary | First `core/post-excerpt` block | before |
| woocommerce_after_single_product | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after | | woocommerce_after_single_product | Last block related to the Single Product Template (Product Image Gallery, Product Details, Add to Cart Form, Product Meta, Product Price, Breadcrumbs) | after |
| woocommerce_product_meta_start | Product Meta | before | | woocommerce_product_meta_start | Product Meta | before |

View File

@ -0,0 +1,4 @@
Significance: major
Type: fix
Compatibility Layer: fix 'woocommerce_before_single_product_summary' hook position.

View File

@ -55,6 +55,7 @@ class SingleProductTemplateCompatibility extends AbstractTemplateCompatibility {
* Since that there is a custom logic for the first and last block, we have to inject the hooks manually. * 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: * The first block supports the following hooks:
* woocommerce_before_single_product * woocommerce_before_single_product
* woocommerce_before_single_product_summary
* *
* The last block supports the following hooks: * The last block supports the following hooks:
* woocommerce_after_single_product * woocommerce_after_single_product
@ -69,6 +70,7 @@ class SingleProductTemplateCompatibility extends AbstractTemplateCompatibility {
'before' => array( 'before' => array(
'woocommerce_before_main_content' => $this->hook_data['woocommerce_before_main_content'], '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' => $this->hook_data['woocommerce_before_single_product'],
'woocommerce_before_single_product_summary' => $this->hook_data['woocommerce_before_single_product_summary'],
), ),
'after' => array(), 'after' => array(),
); );
@ -195,7 +197,7 @@ class SingleProductTemplateCompatibility extends AbstractTemplateCompatibility {
), ),
), ),
'woocommerce_before_single_product_summary' => array( 'woocommerce_before_single_product_summary' => array(
'block_names' => array( 'core/post-excerpt' ), 'block_names' => array(),
'position' => 'before', 'position' => 'before',
'hooked' => array( 'hooked' => array(
'woocommerce_show_product_sale_flash' => 10, 'woocommerce_show_product_sale_flash' => 10,