-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Add support for Gutenberg 12.1.0 block template naming convention #31522
Add support for Gutenberg 12.1.0 block template naming convention #31522
Conversation
Gutenberg 12.1.0 has changed the convention for the directory paths from `block-templates` and `block-template-parts` to `templates` and `parts` respectively. Previously, WooCommerce was checking whether block templates were available, only in the `block-templates` directory. This commit adds support for both older and newer naming conventions, as well as parents and child themes. Fixes #31518
…nvention (#5455) Gutenberg 12.1.0 has changed the convention for the directory paths from `block-templates` and `block-template-parts` to `templates` and `parts` respectively. Allow compatibility with themes which follow both conventions and also make sure that we remain backwards-compatible. Fixes #5450 Some of this fix has a dependency on WooCore See: woocommerce/woocommerce#31522
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.
Thanks for upstreaming this change @sunyatasattva! I left a couple of suggestions, but pre-approving from the WC Blocks side.
Just to clarify, do you think this needs to be included in a future patch release? My understanding is that we need either this fix or woocommerce/woocommerce-blocks#5455 to be included in WC core 6.1 if possible. Am I understanding that right?
I think we'd need both to be included for full functionality. Either won't be enough :/ So yea, if possible, this should be included ASAP. |
Thanks for updating the PR @sunyatasattva!
I'm unable to reproduce the original issue (#31518). From my investigation, it seems to be because we add a filter to Which in woocommerce/woocommerce-blocks#5455 was already updated to account for the new directory structure. Don't get me wrong, I agree this should be upstreamed to WC core, but I would like to make sure if this needs to go into WC core 6.1 or it can wait for WC core 6.2. In any case, cc'ing @jonathansadowski as the release lead of WC 6.1 for awareness. |
Thanks for the ping. If I'm understanding the issue correctly, it seems reasonable to me that this support could wait until 6.2, as it wouldn't break any existing theme, and that a work-around for supporting the newer convention until 6.2 would be to install a version of blocks that includes woocommerce/woocommerce-blocks#5455. Does that seem reasonable or is there something that I'm missing? |
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.
Works great! LGTM
@jonathansadowski we could fix this in Woo Blocks temporarily however this means that WooCommerce Block Templates will not be fully compatible with WordPress 5.9 unless users have WooCommerce Blocks installed as well. I realise this request is beyond the current code freeze but I think it's important to include this fix to ensure compatibility with WP 5.9. |
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.
LGTM as well. I am going to merge to trunk, and leaving the decision for when to include to release lead.
Hi @vedanshujain, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
Yep, I agree with the importance. Thanks for flagging. I'll make sure this gets cherry-picked into 6.1 |
Update the readme file to include changes from #31522
All Submissions:
Changes proposed in this Pull Request:
Gutenberg 12.1.0 has changed the convention for the directory paths from
block-templates
andblock-template-parts
totemplates
andparts
respectively.Previously, WooCommerce was checking whether block templates were available, only in the
block-templates
directory.This commit adds support for both older and newer naming conventions, as well as parents and child themes.
Closes #31518
How to test the changes in this Pull Request:
Using WP 5.8
Using WP 5.9, replicate the steps above with the Gutenberg plugin deactivated.
Other information:
Changelog entry
FOR PR REVIEWER ONLY: