Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    at this moment is not possible to update the counter, it requires an important modification to plugin scripts. We will try to add this feature in future updates.

    Stay tuned, greetings 🙂

    As a work-around, you could change the text that is displayed. Instead of:

    Showing 1-20 of 35 results.

    you could instead show:

    Showing all 35 results

    To do this, copy the file: /wp-content/plugins/woocommerce/templates/loop/result-count.php

    Put the copy of it here: /wp-content/themes/YOURTHEMEORCHILDTHEME/woocommerce/loop/result-count.php

    (Create the directories in your theme if you need to.) This will over-ride the WooCommerce function, without interfering with plugin updates.

    Then comment out line 42, and add this new line:

    printf( __( 'Showing all %d results', 'woocommerce' ), $total );

    Your code, starting at line 29, will look like this:

    <p class="woocommerce-result-count">
    	<?php
    	$paged    = max( 1, $wp_query->get( 'paged' ) );
    	$per_page = $wp_query->get( 'posts_per_page' );
    	$total    = $wp_query->found_posts;
    	$first    = ( $per_page * $paged ) - $per_page + 1;
    	$last     = min( $total, $wp_query->get( 'posts_per_page' ) * $paged );
    
    	if ( 1 === $total ) {
    		_e( 'Showing the single result', 'woocommerce' );
    	} elseif ( $total <= $per_page || -1 === $per_page ) {
    		printf( __( 'Showing all %d results', 'woocommerce' ), $total );
    	} else {
    		//printf( _x( 'Showing %1$d–%2$d of %3$d results. Scroll for the remainder.', '%1$d = first, %2$d = last, %3$d = total', 'woocommerce' ), $first, $last, $total );
    		printf( __( 'Showing all %d results', 'woocommerce' ), $total );
    	}
    	?>
    </p>

    This isn’t perfect, but it’s better than displaying (for example) “Showing 1-20 of 35 results.” when your page will actually display all of the 35 results.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Update WooCommerce Product Count on Next Page Load’ is closed to new replies.