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 product archive header template and re-hook #33681
Conversation
Hi , 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: |
Hi @tommyferry, sorry for the big delay, this pull request fell through the cracks and I missed it. I have reviewed and tested it and it looks fine, but before merging it it should get a changelog file, I tried to add it myself but the |
Hi @Konamiman, thanks for reviewing and pushing this forward. I've followed your suggestion and added the changelog file as well as unprotecting the |
@tommyferry Now I see that there are several CI checks that are failing. This might be because the pull request is quite old, could you please do a merge or a rebase from the current |
Hi @Konamiman, thanks for patience and guidance I've now merged the current woocommerce trunk into this branch, which should hopefully enable the CI checks to succeed so this can be merged. |
Hi @tommyferry, sorry but it looks like a new rebase will be needed. I'll be monitoring this more closely this time to try and merge this asap to prevent further CI problems. |
Moves the product taxonomy archive header into its own template file, creates a related output function, and then re-hooks the new template back into the archive-product.php file in the same place, via the 'woocommerce_before_main_content' hook, priority 40. This is so that this template part can be removed/unhooked via the 'remove_action' function, which is a cleaner approach than template overrides or additional style changes. Resolves: woocommerce#33672
No worries @Konamiman, I've just rebased so hopefully this should now be correctly passing all tests. Let me know if there's anything else needed on this - it all looks correct to me (and a fairly minor addition) but happy to make further changes as needed. Thanks! |
@Konamiman - I noticed the recent updates were failing due to a missing template version bump. I've added those now |
@tommyferry Looks like there are still missing template version bumps:
|
Hey @Konamiman, I've just noticed that too - it's very strange as I bumped one of those and the other is a new file... Perhaps I'm missing something here though, should the version be bumped to the version of WC? |
Hi @tommyferry, indeed the version number expected here is the WooCommerce version where the bump happened, which would be |
Ahh that makes sense, thanks so much @Konamiman - all updated now. Fingers crossed for the workflows to pass this time :) |
Hi @tommyferry. I've checked with my team as I wasn't sure why tests were still failing, and turns out that there's a problem with the code, specifically here: if ( ! function_exists( 'woocommerce_product_taxonomy_archive_header' ) ) {
function woocommerce_product_taxonomy_archive_header() {
if ( is_product_taxonomy() ) {
wc_get_template( 'loop/header.php' );
}
}
} The problem is the I think that the cleanest solution, also consistent with the rest of the code in |
Hey @Konamiman, thanks for your help in diagnosing the problem - I've implemented the suggested change now and pushed the update. I did wonder whether it would be possible to achieve the same thing with an additional |
* Add product archive header template and re-hook Moves the product taxonomy archive header into its own template file, creates a related output function, and then re-hooks the new template back into the archive-product.php file in the same place, via the 'woocommerce_before_main_content' hook, priority 40. This is so that this template part can be removed/unhooked via the 'remove_action' function, which is a cleaner approach than template overrides or additional style changes. Resolves: #33672 * add product archive header template changelog * bump template versions * bump template versions correctly * add a new hook in the archive-product.php template for the header template
@Konamiman @tommyferry hi here :) seems the template version and function addition version at this time should be |
Moves the product taxonomy archive header into its own template file, creates a related output function, and then re-hooks the new template back into the archive-product.php file in the same place, via the new
woocommerce_shop_loop_header
hook.This is so that this template part can be removed/unhooked via the
remove_action
function, which is a cleaner approach than template overrides or additional style changes. Moreover, this is consistent with the rest of thearchive-product.php
template, which is already being rendered via actions.All Submissions:
Changes proposed in this Pull Request:
Closes #33672
How to test the changes in this Pull Request:
Result: Archive header should appear as normal.
remove_action( 'woocommerce_shop_loop_header', 'woocommerce_product_taxonomy_archive_header', 40 );
Result: Archive header should be removed from the markup.
Other information:
pnpm changelog add --filter=<project>
?FOR PR REVIEWER ONLY: