[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
    Posts
  • #146257
    Joseph

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

    // load specific page
    query_posts(‘page_id=7’);

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

    // stop any other woocommerce code executing
    exit;
    ?>

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

    <?php

    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’ ) ) {
    woocommerce_content();
    }else{
    //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 –>

    <?php
    do_action(‘generate_sidebars’);
    get_footer();

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

    thanks
    Joe

    #146356
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What’s the result of using the above template?

    I can’t see anything obviously wrong.

    #146422
    Joseph

    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.

    #146527
    Tom
    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.