Woocommerce template overriding not working

16,832

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 :

  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.
Share:
16,832

Related videos on Youtube

Mobashir
Author by

Mobashir

I'm a wordpress & Shopify developer. I love to code, facing new challenges and always eager to learn more.

Updated on June 04, 2022

Comments

  • Mobashir
    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
    Mobashir over 6 years
    Yes I've read this documents and I'm sure there is no woocommerce.php file located in my theme directory.
  • Mo'men Mohamed
    Mo'men Mohamed over 6 years
    Check my answer again
  • Mobashir
    Mobashir over 6 years
    Yes, I'm sure there is no template debug mode activated.
  • Lucas Bustamante
    Lucas Bustamante almost 6 years
    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.php
  • Lee
    Lee about 5 years
    There'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
    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
    osemec over 3 years
    Clearing template cache in settings above solved the problem.
  • Nathan
    Nathan over 2 years
  • Shane Muirhead
    Shane Muirhead over 2 years
    The link to the docs shows you don't use templates folder in your themes directory. So this answer is correct?
  • Dorji Tshering
    Dorji Tshering over 2 years
    I had the correct directory structure so the above answers didn't help me. Clearing template cache finally worked for me. High five!