Working with my own theme found a problem with WooCommerce product template wrapper start & end,
i found static wrapper tag, this should be filterable by filter hook.
in woocommerce\templates\global\wrapper-start.php
file
<div id="primary" class="content-area"><main id="main" class="site-main" role="main">
// should be like this
echo apply_filters('woocommerce_templates_wrapper_start', '<div id="primary" class="content-area"><main id="main" class="site-main" role="main">');
in woocommerce\templates\global\wrapper-end.php
file
echo '</main></div>';
// should be like this
echo apply_filters('woocommerce_templates_wrapper_end', '</main></div>');
I hope this will be helpful for custom wrapper setup.
pull
Regards
You can use the following code to unhook the wrappers should you not need them.
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
Then you can use the actions woocommerce_before_main_content and woocommerce_after_main_content to add any wrappers you want for your theme.
So as you can see these are already filterable in a different way so no need to add another filter inside the templates.
But, i don't understand.
Why to remove the action, whe i can create the file global/wrapper-start.php and write the code inside.
But for me it doesn't work.
But, i don't understand.
Why to remove the action, whe i can create the file global/wrapper-start.php and write the code inside.
But for me it doesn't work.
Did you add this code to yout funcctions.php file?
add_theme_support('woocommerce');
Also please note that the way you chose is called "woocommerce template override" which has its drawback.
using hooks inside your theme to customize woocommerce theme is recommended way based on this https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/
Most helpful comment
You can use the following code to unhook the wrappers should you not need them.
Then you can use the actions woocommerce_before_main_content and woocommerce_after_main_content to add any wrappers you want for your theme.
So as you can see these are already filterable in a different way so no need to add another filter inside the templates.