You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
Make Products by category/tag/attribute fallback to the Product catalog template (#7712)
* Add archive-product to the hierarchy
* Fallback to archive-product and get titles from blocks if the templates from theme don't have one
* Rename function
* Fix comment
* Add fallbacks to the db and blocks versions
* Add missing product attribute blockified template
* Update docs
* Add comment and fix comment type on wp_template
* Replate template name if we know the template in blocks
* Add comment and fix linting error
* Fix archive-product template
* Clone the fallback template from db to show them in the template lsit
* Return the fallback template when querying for a single template
* Remove unneeded condition
* Use wp function instead of gutenberg one
* Fix tests
* Fix tests on Product Catalog templates
It was checking a single product for the customization, but it should check the /shop page
* Disable tests related with deleteAllTemplates function
Copy file name to clipboardexpand all lines: docs/internal-developers/templates/block-template-controller.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ This method is applied to the filter `get_block_templates`, which is executed be
36
36
37
37
- Giving our templates a user-friendly title (e.g. turning "single-product" into "Product Page").
38
38
- It collects all the WooCommerce templates from both the filesystem and the database (customized templates are stored in the database as posts) and adds them to the returned list.
39
-
- In the event the theme has a `archive-product.html` template file, but not category/tag template files, it is eligible to use the `archive-product.html` file in their place. So we trick Gutenberg in thinking some templates (e.g. category/tag) have a theme file available if it is using the `archive-product.html` template, even though _technically_ the theme does not have a specific file for them.
39
+
- In the event the theme has a `archive-product.html` template file, but not category/tag/attribute template files, it is eligible to use the `archive-product.html` file in their place. So we trick Gutenberg in thinking some templates (e.g. category/tag/attribute) have a theme file available if it is using the `archive-product.html` template, even though _technically_ the theme does not have a specific file for them.
40
40
- Ensuring we do not add irrelevant WooCommerce templates in the returned list. For example, if `$query['post_type']` has a value (e.g. `product`) this means the query is requesting templates related to that specific post type, so we filter out any irrelevant ones. This _could_ be used to show/hide templates from the template dropdown on the "Edit Product" screen in WP Admin.
// If the theme has an archive-product.html template, but not a taxonomy-product_cat/tag/attribute.html template let's use the themes archive-product.html template.
115
-
if ( BlockTemplateUtils::template_is_eligible_for_product_archive_fallback( $template_slug ) ) {
193
+
if ( BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme( $template_slug ) ) {
// If the theme has an archive-product.html template, but not a taxonomy-product_cat/tag/attribute.html template let's use the themes archive-product.html template.
335
-
if ( BlockTemplateUtils::template_is_eligible_for_product_archive_fallback( $template_slug ) ) {
424
+
if ( BlockTemplateUtils::template_is_eligible_for_product_archive_fallback_from_theme( $template_slug ) ) {
0 commit comments