Skip to content

Commit

Permalink
Improve the Compatibility Layer docs to minimise confusion (#44924)
Browse files Browse the repository at this point in the history
* Improve the Compatibility Layer docs to avoid confusion

* Add changelog

* Add punctuation
  • Loading branch information
kmanijak authored and Konamiman committed Mar 13, 2024
1 parent 6746ad6 commit de8aa34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
# Compatibility Layer - [AbstractTemplateCompatibility.php](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/Templates/AbstractTemplateCompatibility.php)

The Compatibility Layer ensures that blockified templates work correctly with extensions that use hooks to extend their behavior. It appends/pre-appends the corresponding hooks to each block. Also, it removes the default callbacks added to those hooks by WooCommerce.
The Compatibility Layer disables when the `WooCommerce Single Product`, `WooCommerce Product Attribute`, `WooCommerce Product Taxonomy`, `WooCommerce Product Tag`, `WooCommerce Product Search Results` or `WooCommerce Product Grid` block is added on the page. Furthermore, it is possible to disable the compatibility layer via the hook: [`woocommerce_disable_compatibility_layer`](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/Templates/AbstractTemplateCompatibility.php/#L41-L42).

The Compatibility Layer is disabled when either of classic template blocks are added on the page:

- `WooCommerce Single Product`,
- `WooCommerce Product Attribute`,
- `WooCommerce Product Taxonomy`,
- `WooCommerce Product Tag`,
- `WooCommerce Product Search Results`,
- `WooCommerce Product Grid`.

Please note these blocks represent classic templates. As an example, using Single Product block won't disable Compatibility Layer.

Furthermore, it is possible to disable the compatibility layer via the hook: [`woocommerce_disable_compatibility_layer`](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/Templates/AbstractTemplateCompatibility.php/#L41-L42).

## Archive Product Templates - [ArchiveProductTemplatesCompatibility](https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/Templates/ArchiveProductTemplatesCompatibility.php)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: tweak

Compatibility Layer: improve the documentation so it's less confusing

0 comments on commit de8aa34

Please sign in to comment.