WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] archive-product.php template overwrite not working. (8 posts)

  1. nikasama83
    Member
    Posted 1 year ago #

    Im trying to overwrite the landing shop template: myTheme/ woocommerce/ archive-product.php .

    Woocommerce shows it as overwritten under System Status but it is not changing, i have successfully changed other templates without problems but this one refuses to change.

    WP 3.7.1 , Woo 2.0.20 . It also happened with Woo 2.0.19.

    I have seen other posts about the same issue, most of them +9 months old but with no clear solution.

    Am I missing something? Is this a known bug that I keep overlooking? How to fix this?

    Thanks guys, any ideas would be great.

    http://wordpress.org/plugins/woocommerce/

  2. nikasama83
    Member
    Posted 1 year ago #

    SO since i didnt get any support from woo i end up spending a large amount of time looking for the problem ... and a solution.

    Issue: archive-product.php custom template would get completely ignored.

    Problem: woocommerce-template.php, woocommerce_content() function is wrong for any archive product case.

    quick solution: on your woocommerce.php template you created instead of

    woocommerce_content();

    use this logic:

    if ( is_singular( 'product' ) ) {
         woocommerce_content();
      }else{
       //For ANY product archive.
       //Product taxonomy, product search or /shop landing
        woocommerce_get_template( 'archive-product.php' );
      }

    This will call your woo template, that would be YOURTHEME/ woocommerce/ archive-product.php and you wont have to edit any file inside the plugin folder

    I hope this helps anyone with a similar problem that did not buy their theme.

  3. bassjobsen
    Member
    Posted 1 year ago #

    Thanks for posting your issue and solution here. I found something similar, your fix helps here too. See: https://github.com/bassjobsen/jamedo-bootstrap-start-theme/archive/master.zip

    For me its not clear why the template system not work with woocommerce_content().

  4. joeleade
    Member
    Posted 9 months ago #

    Thanks @nikasama83. I've taken on a project using a non-WooThemes theme and had the same problem. This snippet has got me back on track.

    Cheers!

  5. walaueh
    Member
    Posted 5 months ago #

    Just would like to share. I have faced the same problem and I edited changed the Product Archives - Sitename by using Yoast SEO Plugin and editing the Custom Post Type Archives. Saw it here: https://proserveweb.com/change-woocommerce-product-archives-page-title/

  6. rosocorso
    Member
    Posted 5 months ago #

    Hi,

    Facing this same problem, but I'm not able to find the line

    woocommerce_content();

    Is it supposed to be in woocommerce/woocommerce.php?

    I have been stuck here for a while, really considering to change Woocommerce for some other plugin...

    Cheers!

  7. hannahcreative
    Member
    Posted 5 months ago #

    The line woocommerce_content(); should be in your themes main directory....

    yourtheme/woocommerce.php

  8. somethumb
    Member
    Posted 3 months ago #

    The answer is that when you updated to the newest version of woocommerce, you have to "reinstall" the woocommerce pages because the old system did not use the wc_get_page_id() function, which looks for the shop page.

    Luckily this is super easy! Go to your admin, then to WooCommerce, then to System Status, then click on the Tools tab. Then click the button to the right of Install WooCommerce Pages. This will only install the missing WooCommerce pages and, get this, will reinstall the shop page with the proper "wc_get_page_id".

    NOTE: if you have content in the original wordpress shop page, although it didn't erase it for me, you might just want to copy the content first just in case.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.