• Resolved nimh

    (@nimh)


    I’ve narrowed it down to this piece of code:
    file: single-product.php

    <?php while ( have_posts() ) : the_post(); ?>
    		<?php wc_get_template_part( 'content', 'single-product' ); ?>
    		<?php endwhile; // end of the loop.
    		    ?>

    <?php wc_get_template_part( ‘content’, ‘single-product’ ); ?> gives an infinite loop of the selected product. When I remove that line and just replace with a test string no loop occurs.
    I’m guessing because it looks to be calling itself. With that being said, this is the exact copy from the woocommerce plugin (copied to myTheme/woocommerce) that I’m editing here. If I remove the code from the content-single-product.php file, no loops occur.

    can someone please help me in figuring out what really needs to go there if this is incorrect code on installation?

    Thanks,

    https://www.ads-software.com/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Do you have a custom version of this template file? https://github.com/woothemes/woocommerce/blob/master/templates/content-single-product.php

    There is no loop inside it – its just content.

    Thread Starter nimh

    (@nimh)

    I just copied the file exactly from the woocommerce plugin and put it into my theme folder like it instructed to do. I havent modified it yet.

    my theme folder files:

    myTheme/
    
    	category-product-reviews.php
    	comments.php
    	front-page.php
    	functions.php
    	header.php
    	index.php
    	page.php
    	search.php
    	sidebar.php
    	single-product-reviews.php
    	single.php
    	style.css
    
    	woocommerce/
    		archive-product.php
    		content-product.php
    		content-single-product.php
    		single-product.php
    Plugin Contributor Mike Jolley

    (@mikejolley)

    > I just copied the file exactly from the woocommerce plugin and put it into my theme folder like it instructed to do. I havent modified it yet.

    I don’t know who is instructing you to do this, but don’t. Only copy across files you intend on actually changing – leave the rest alone.

    There is no endless loop in the plugin by default, so remove your changes and customise 1 file at a time.

    Thread Starter nimh

    (@nimh)

    The file itself says to do this:
    * Override this template by copying it to yourtheme/woocommerce/single-product.php

    I had copied it over so i could make changes to it.

    What is this file defaulting to? single.php?
    I have a custom theme I’m building that has a single.php template… do you think it’s pulling from it?

    Thread Starter nimh

    (@nimh)

    I figured it out… apparently one of my custom templates was named similarly to an existing woocommerce template… changed the name and all works as expected.

    thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Infinite Loops on Single Item view’ is closed to new replies.