Support » Plugin: WooCommerce » [Custom template]Including shop page in index.php

  • Hi !

    I’m building a “one page” design theme for a client, with an e-commerce section using woocommerce.

    So I need my shop page (showing all products) to be included in index.php.

    So I read the documentation and with the help of this page i decided to use this :

    <section id="shop" class="viewport">
          <?php woocommerce_content(); ?>

    But everything I get is only a empty ul :

    <section class="viewport" id="shop">
         <h1 class="page-title">Boutique</h1>
             <ul class="products"></ul>

    I have 1 product that is visible and available, and it’s not showing 🙁 .
    I tried to use the Loop to display directly the shop page by its ID, I had the same behavior.

    But when I’m making my query to the shop page like this <?php query_posts('page_id=4'); ?> and then use the woocommerce_content(); function I get the title, and the message “Here’s the only result:” (not sure if it’s like this in english version), but my ul.products is still empty…

    What am I doing wrong ?

    Thanks for your help 🙂 !


Viewing 1 replies (of 1 total)
  • Why not use the product short code?

    [products ids="1, 2, 3, 4, 5"]

    and echo it in the index page where you want like so:

    <?php echo do_shortcode('[products ids="1, 2, 3, 4, 5"]'); ?>

    If you want to display the whole single product page you can use this:

    <?php echo do_shortcode('[product_page id="99"]'); ?>

    Just change the id to yours

Viewing 1 replies (of 1 total)
  • The topic ‘[Custom template]Including shop page in index.php’ is closed to new replies.