New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix block templates not being rendered in extension taxonomies #44850
Conversation
Test Results SummaryCommit SHA: d275bac
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Hi @WunderBart, @imanish003, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
6724c96
to
434c232
Compare
434c232
to
1bba52a
Compare
…tes-not-rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Aljullu,
I've tested the changes and everything is functioning as anticipated. I've left some minor comments and will await your response before giving my approval to this PR 🚀.
Thank you for your excellent work around templates so far 🙌🏻
plugins/woocommerce/changelog/fix-44453-fix-block-templates-not-rendering
Show resolved
Hide resolved
plugins/woocommerce/changelog/fix-44453-fix-block-templates-not-rendering
Show resolved
Hide resolved
…tes-not-rendering
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can repro #44453, but this PR doesn't seem to fix it. Here's what I see for the following themes on both trunk
and this branch:
2024 | Tsubaki | Storefront |
---|---|---|
Looks like Storefront is affected as well, and only 2024 seems to render the results correctly.
EDIT
I misunderstood the issue, but it seems to have been actually fixed on trunk
as well as the page does not render differently on this branch.
You're right, @WunderBart! It looks like the refactor PR (#44537) already fixed that issue. 😄 I updated the description of this PR and the refactor PR to account for that. |
Thanks for the reviews, folks! I think all comments have been answered and I updated the PR description and testing steps to account for the fact that #44453 was already fixed in PS: even though #44453 has been fixed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified the changes again & everything is working as expected
Changes proposed in this Pull Request:
Alternative approach from #44646.
Closes #44453. (Update: it turns out #44537 already fixed this issue)
In some circumstances,
woocommerce_has_block_template
wasn't set totrue
correctly, that meant that we were rendering a broken PHP template instead of the correct block template.The issue was only reproducible in block themes with certain custom WooCommerce templates (ie: Tsubaki, which has the
archive-product.html
template), and were only reproducible in these cases:When rendering the Shop page with certain filters (what's described in Shop Page Filter Query Causes Inconsistent Block UI Rendering Without Product Attribute Lookup Table #44453).(Update: This was already fixed intrunk
thanks to Shop Page Filter Query Causes Inconsistent Block UI Rendering Without Product Attribute Lookup Table #44453)This PR removes a check we had in the code that would only set
woocommerce_has_block_template
if the template was not in the theme.How to test the changes in this Pull Request:
Verify correct template is rendered with certain settings (#44453)
(Update: this issue was actually fixed in #44537, but I'm adding the testing steps here just to verify there are no regressions)
/shop/?product_cat=Clothing&filter_size=large
. Note: the values ofproduct_cat
andfilter_xyz
might vary depending on the categories and attributes of your store. In case of doubt, you can import the products fromsample-data
.Verify taxonomies added by extensions are rendered correctly (testing for devs)
class-wc-brands-block-templates.php
and comment out this line:add_filter( 'woocommerce_has_block_template', array( $this, 'has_block_template' ), 10, 2 );
.Changelog entry
Significance
Type
Message
Comment