Woocommerce template overriding not working
Solution 1
If you've already read this documents https://docs.woothemes.com/document/template-structure/
Please Note: When creating woocommerce.php in your theme’s folder, you will be unable to override the woocommerce/archive-product.php custom template in your theme, as woocommerce.php has priority over all other template files. This is intended to prevent display issues.
Also make sure that you don’t have “Template Debug Mode” activated that you can find under:
WP Dashboard -> WooCommerce -> System Status -> Tools
Solution 2
After lots of researching, finally I've found my answer from here WordPress - Failing to override woocommerce templates
Actually, I use all of my files inside the template folder and this is the reason why it didn't work.
So simple steps. But I can't understand how was I miss it!
Thank's Mo'men Mohamed for your suggetions.
Solution 3
Try to declare Woocommerce support in your theme's function.php
Solution 4
I had an issue with this relating to the WooCommerce template cache.
The cache can be cleared by navigating to:
WooCommerce > Status > Tools > Clear template cache
Solution 5
Yes i agree with Mobashir. There are three steps to check why override not working :
- Check in functions.php for woocommerce supported added ( URL : https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/ )
- Check spelling of directory and files is proper in theme such as your-theme/woocommerce. ( URL : https://docs.woocommerce.com/document/template-structure/ )
- Woocommerce allow to change the location of woocommerce template. Hook is : woocommerce_template_path .If you are using the premium theme then check for filter hook in your theme's functions.php file. If that hook exits then use that location which is mention in that hook's callback function.
Related videos on Youtube
Mobashir
I'm a wordpress & Shopify developer. I love to code, facing new challenges and always eager to learn more.
Updated on June 04, 2022Comments
-
Mobashir almost 2 years
I want to override woocommerce templates from my theme. I follow all the steps from the official documents of woocommerce. And I'm sure that there is no woocommerce.php file in my theme. So, I can;t understand why it isn't working. I'm using twenty seven theme.
Any help will be appreciated.
-
Mobashir over 6 yearsYes I've read this documents and I'm sure there is no woocommerce.php file located in my theme directory.
-
Mo'men Mohamed over 6 yearsCheck my answer again
-
Mobashir over 6 yearsYes, I'm sure there is no template debug mode activated.
-
Lucas Bustamante almost 6 yearsTo make it clearer, remove "templates" folder, as in:
your-theme/woocommerce/templates/checkout/form-checkout.php
turns intoyour-theme/woocommerce/checkout/form-checkout.php
-
Lee about 5 yearsThere's no definitive answer here... this has been marked as accepted but the comments would suggest this didn't solve the issue.
-
Mo'men Mohamed about 5 years@Lee I think he did not understand the answer clearly so he applauded in the following comment that the answer was true but when he understood it correctly.
-
osemec over 3 yearsClearing template cache in settings above solved the problem.
-
Nathan over 2 yearsHere's how: docs.woocommerce.com/document/…
-
Shane Muirhead over 2 yearsThe link to the docs shows you don't use
templates
folder in your themes directory. So this answer is correct? -
Dorji Tshering over 2 yearsI had the correct directory structure so the above answers didn't help me. Clearing template cache finally worked for me. High five!