Support » Plugin: WooCommerce » WP loop in WooComerce theme (archive-product.php)

  • Basically I want to make a WP loop for the Woocommerce products in archive-product.php

    This being an example:

    $args = array(
        'post_type' => 'product',
        'posts_per_page' => 10,
        'orderby' => 'date',
        'order' => 'desc'
    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ) {
        while ( $loop->have_posts() ) : $loop->the_post(); ?>
        <a href="<?php echo get_permalink( $loop->post->ID ) ?>"><?php the_title(); ?></a>
        <?php   endwhile;
        } else { echo __( 'No products found' ); }

    But it doesn’t seem to display anything and even makes the page go blank when I try to access said page.

    My question is if I can modify this loop easily to do what I want or even better if I can make all the Woocommerce category pages go to the category.php of the standard WP themes (since I have an easier time editing that to my liking )

    Thank you in advance for your answers and time 🙂

  • The topic ‘WP loop in WooComerce theme (archive-product.php)’ is closed to new replies.