[Resolved] Woocommerce archive-product.php

Home Forums Support [Resolved] Woocommerce archive-product.php

Home Forums Support Woocommerce archive-product.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #146257

    Hi, If i had my own archive-product.php that just loads as a normal page:
    // override archive-product.php

    // load specific page

    // load the page template for the current theme
    include get_template_directory() . “/” . “page.php”;

    // stop any other woocommerce code executing

    would this be the correct way to edit the woocommerce.php for this to work?


    get_header(); ?>

    <main id=”main” <?php generate_main_class(); ?>>
    <?php do_action(‘generate_before_main_content’); ?>
    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?> <?php generate_article_schema( ‘CreativeWork’ ); ?>>

    <?php do_action( ‘generate_before_content’); ?>

    <?php if ( function_exists( ‘woocommerce_content’ ) ) :
    if ( is_singular( ‘product’ ) ) {
    //For ANY product archive.
    //Product taxonomy, product search or /shop landing
    woocommerce_get_template( ‘archive-product.php’ );
    endif; ?>

    <!– .entry-content –>
    <?php do_action( ‘generate_after_content’); ?>

    <!– .inside-article –>
    </article><!– #post-## –>
    <?php do_action(‘generate_after_main_content’); ?>
    </main><!– #main –>

    <!– #primary –>


    I’m having some troubles with a plugin, just wanted to know if it was the plugin or me doing these files wrong.


    Lead Developer
    Lead Developer

    Hi there,

    What’s the result of using the above template?

    I can’t see anything obviously wrong.


    It may be a problem with the widget I’m using if this is the correct way. All it does is query the products and display them all with a filter at the top for the categories.
    Works fine on GeneratePress Theme but on the main shop page obviously Woocommerce also puts the products on the page with woocommerce_content so i have them all twice.

    I then try to use a Child Theme and these modified files to stop woocommerce loading any products on the main shop page so it displays as a normal page so i can just use this widget but when using the files it shows the products fine in a grid and the filter works as normal but for some reason the product names and descriptions are added after the grid in separate blocks all the way down the page.
    Strange that it doesn’t do that with the original theme activated.

    not sure if it is the widget or the files because they both work, just not with eachother.

    Lead Developer
    Lead Developer

    GeneratePress has a woocommerce.php file which you can try adjusting in your child theme – it uses woocommerce_content, so that could be why you’re having trouble.

    Let me know 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.