Skip to content
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

[Enhancement]: Move product taxonomy archive header HTML into its own template and re-hook #33672

Closed
tommyferry opened this issue Jun 30, 2022 · 0 comments · Fixed by #33681
Closed
Labels
focus: template Issue related to WooCommerce templates. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Proton type: enhancement The issue is a request for an enhancement.

Comments

@tommyferry
Copy link
Contributor

tommyferry commented Jun 30, 2022

Describe the solution you'd like

The product taxonomy archive header (in the product archive template: plugins/woocommerce/templates/archive-product.php:32-46) cannot currently be individually removed if needed/wanted.

Some themes or plugins may want to remove or replace this section and, as this chunk of the template is 'hardcoded' in place, their only option at the moment is to override the whole archive-product.php template. Alternatively, additional "hacky" styles might be used to hide this <header> element (e.g. display: none, etc), which leave unwanted HTML markup on the site simply because there's no simple option.

I think it would be useful to separate this chunk of code into its own template part & output function, and then re-hook it back into the same place, for example on woocommerce_before_main_content at priority 40. This would mean no current approaches to removing this section will break/need to change but the future approach could be to simply unhook it (conditionally or otherwise).

Additionally, t looks like this change might have a knock on effect with the 'Classic Template' WooCommerce Block: https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/BlockTypes/ClassicTemplate.php - so a related PR will need to be created to remove this header section there as well.

Describe alternatives you've considered

No response

Additional context

No response

@tommyferry tommyferry added status: awaiting triage This is a newly created issue waiting for triage. type: enhancement The issue is a request for an enhancement. labels Jun 30, 2022
tommyferry added a commit to tommyferry/woocommerce that referenced this issue Jun 30, 2022
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
@jonathansadowski jonathansadowski added focus: template Issue related to WooCommerce templates. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: prioritization and removed status: awaiting triage This is a newly created issue waiting for triage. labels Jul 1, 2022
@Konamiman Konamiman added priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. and removed status: prioritization labels Jul 15, 2022
tommyferry added a commit to tommyferry/woocommerce that referenced this issue Jan 3, 2024
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
jonathansadowski pushed a commit that referenced this issue Mar 7, 2024
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
jonathansadowski pushed a commit that referenced this issue Mar 8, 2024
* 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 pushed a commit that referenced this issue Mar 13, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: template Issue related to WooCommerce templates. plugin: woocommerce Issues related to the WooCommerce Core plugin. priority: normal The issue/PR is of normal priority—not many people are affected or there’s a workaround, etc. team: Proton type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants