As per official woocommerce documentation (here), the proper and safe way to override default woocomerce templates via theme is to create a sub-folder under the theme directory with the 'default' name /woocommerce and copy the targeted templates into it and make some changes ..

Example: to override the archive-product.php template, copy:




So is there any possible way to override the default woocommerce templates folder : /woocommerce under the theme directory and move it to an other folder let say /<your-theme>/plugins/woocommerce ?

in fact, many plugins out there (woocommerce, bbpress among others) suggest creating sub-folder under the theme directory with the name of the plugin (/woocommerce, /bbpress) to hold the overridden templates and in order to bring some organization to my theme folder it does make sens to me to create sub-folder /plugins under my theme directory where i can hold my own templates so archive-product.php would be located under


and not


as expected.

i looked at those core functions: wc_get_template_part, wc_get_template, wc_get_template_html and wc_locate_template under /includes/wc-core-functions.php but i can't figure out how to override the default location (applying filters ..)

i appreciate your kind help.

1 Answer 1


I believe you can use the woocommerce_template_path hook/filter:

// $path defaults to 'woocommerce/' (in your theme folder)
add_filter( 'woocommerce_template_path', function( $path ){
    $my_path = get_stylesheet_directory() . '/plugins/woocommerce/';
    return file_exists( $my_path ) ? 'plugins/woocommerce/' : $path;
} );

It should work whether you're overriding only specific files or all — i.e. you copy all files and folders from wp-content/plugins/woocommerce/templates to your theme.

  • thx a lot for your quick hint, i'll give it try and come back to you. yes it should work.
    – user34803
    May 23, 2019 at 2:59
  • Sure, take your time.
    – Sally CJ
    May 23, 2019 at 3:09
  • yes, it works as expected and i accept your answer, but the only thing i got is that my theme is getting rendered little bit slower (even before i add this filter, i mean with the default woocommerce's location '/woocommerce' under the theme directory), i have to say i'm trying to override the 'whole' woocommerce templates to support bootstratp 4 (lot of work) so do you have any idea who to optimize the loading time later on server ? i'm working on my local machine.
    – user34803
    May 23, 2019 at 8:50
  • There are various performance optimization you could do - use valid HTML/CSS/JS/PHP, avoid using unnecessary JS/PHP code/scripts/libraries (i.e. use only what you need), use functions than repeating the same block of code, etc. - but are you sure it's the theme causing the issue? Have you tried a default theme? How about disabling all plugins except WooCommerce?
    – Sally CJ
    May 23, 2019 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.