Replacing the WooCommerce template for Archive-Product.php (Store main page) Does not work

I canโ€™t let my life override the main page of the store.

I understand that it is archive-product.php

I tried to copy it to the Woocommerce directory that I created in the root directory of the theme, and change it. No dice.

I also tried changing it directly in the Woocommerce plugins directory. There are no dice either.

I even got to adding an underscore in front of the archive-product.php file name in both places (woocommerce directory and theme template directory), trying, hopefully, to BREAK it - just see if I can affect SOME changes - and this also has no effect .

I do not run cache plugins and all other Woocommerce template files that I tried to change until this point worked fine.

Any ideas?

+4
source share
4 answers

You are doing it right. You will have to double check the places according to:

  • The store template is located in plugins/woocommerce/templates/archive-product.php

  • You can copy to my-themes/woocommerce/archive-product.php to override the main woocommerce file.

+5
source

I had the same problem, What worked for me, deletes the woocommerce.php file, because earlier it applied the woocommerce.php template to the store, and not to the archive.

+4
source

The answer is that when you upgrade to the latest version of woocommerce, you need to "reinstall" woocommerce pages because the old system did not use the wc_get_page_id () function, which searches for the store page.

Fortunately, it is very simple! Go to your administrator, then in WooCommerce, then in system status, then open the "Tools" tab. Then click the button to the right of the Install WooCommerce Pages page. This will install only the missing WooCommerce pages and, upon receiving this, reinstall the store page with the corresponding "wc_get_page_id".

NOTE. If you have content on the original WordPress Store page, although it does not delete it for me, you can simply copy the content first just in case.

+1
source

I managed to fix it using the sentence here - Changes in archive-product.php do not work

but it seems to me that this is a mistake. WooCommerce claims that you need this root woocommerce.php page to include the plugin in your own theme - http://docs.woothemes.com/document/third-party-custom-theme-compatibility/ - but this does the job.

I would like to know what reasoning is.

Switching to the twenty / twenty tewelve theme and trying to override the archive-product.php file did a great job in the same way, but they do not include the native woocommerce.php file in the root directory. What gives?

0
source

Source: https://habr.com/ru/post/1500359/


All Articles