Woocommerce template overriding not working
Asked Answered
P

9

6

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.

Pierpont answered 23/8, 2017 at 20:13 Comment(0)
G
7

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

Gyroplane answered 24/8, 2017 at 0:27 Comment(7)
Yes I've read this documents and I'm sure there is no woocommerce.php file located in my theme directory.Pierpont
Check my answer againDeration
Yes, I'm sure there is no template debug mode activated.Pierpont
There's no definitive answer here... this has been marked as accepted but the comments would suggest this didn't solve the issue.Expand
@Expand 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.Deration
Clearing template cache in settings above solved the problem.No
The link to the docs shows you don't use templates folder in your themes directory. So this answer is correct?Vitrescence
U
18

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

Unskillful answered 26/5, 2021 at 13:51 Comment(2)
I had the correct directory structure so the above answers didn't help me. Clearing template cache finally worked for me. High five!Mello
After hours of debugging, I found this to be the only working solution. Cheers!Lentissimo
T
8

Try to declare Woocommerce support in your theme's function.php

Transferor answered 7/7, 2018 at 14:47 Comment(1)
Here's how: docs.woocommerce.com/document/…Premium
G
7

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

Gyroplane answered 24/8, 2017 at 0:27 Comment(7)
Yes I've read this documents and I'm sure there is no woocommerce.php file located in my theme directory.Pierpont
Check my answer againDeration
Yes, I'm sure there is no template debug mode activated.Pierpont
There's no definitive answer here... this has been marked as accepted but the comments would suggest this didn't solve the issue.Expand
@Expand 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.Deration
Clearing template cache in settings above solved the problem.No
The link to the docs shows you don't use templates folder in your themes directory. So this answer is correct?Vitrescence
P
7

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.

Pierpont answered 27/8, 2017 at 19:34 Comment(2)
To make it clearer, remove "templates" folder, as in: your-theme/woocommerce/templates/checkout/form-checkout.php turns into your-theme/woocommerce/checkout/form-checkout.phpNarial
Yeah this worked for me. ThanksLabionasal
M
2

I'm facing the same issue. I am using the JupiterX theme with Elementor and trying to override the checkout template in the JupiterX Child theme, but it's not loading. I have double checked the path, it's like themes/jupiterx-child/woocommerce/checkout/form-checkout.php.

Solution:

I have resolved the issue. Actually, the JupiterX theme has its own WooCommerce overriding structure, that is themes/jupiterx/lib/templates/woocommerce/checkout/form-checkout.php and the same for the child theme that is themes/jupiterx-child/lib/templates/woocommerce/checkout/form-checkout.php.

For more details: themes.artbees.net/docs/overriding-woocommerce-templates

Mercurialize answered 20/10, 2020 at 10:44 Comment(0)
O
2

I had this issue too.

Clear cache, then just swap/activate themes to a wordpress standard theme, then swap back to yours. Happy Days!

Okie answered 4/5, 2023 at 5:46 Comment(0)
S
1

Yes i agree with Mobashir. There are three steps to check why override not working :

  1. Check in functions.php for woocommerce supported added ( URL : https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/ )
  2. Check spelling of directory and files is proper in theme such as your-theme/woocommerce. ( URL : https://docs.woocommerce.com/document/template-structure/ )
  3. 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.
Shelli answered 11/6, 2020 at 11:50 Comment(0)
B
1

FYI, to anyone for whom these solutions didn't work - my issue was that although my child theme (Velux) didn't have a woocommerce.php file in it, my parent theme (Primer) had a woocommerce.php in wp-content/themes/primer/inc/compat. I'm not sure what was in it that was conflicting, but when I replaced it with a blank woocommerce.php file (deleting it gave me a critical error), my overrides started working.

Brussels answered 17/1 at 7:23 Comment(0)
R
0

After you've made the updates to the templates, try Clearing transients in Woocommerce/Status/Tools

WooCommerce transients This tool will clear the product/shop transients cache.

Raspberry answered 1/8 at 16:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.