Home Forums WoodMart support forum Populare products on top of shop pages

Populare products on top of shop pages

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #123365

    metuza
    Participant

    I have a plugin to display the most popular products on the very top of shop pages but whatever i do editing my code using echo, return, content & ob get clean, priority on action hook and also tested your hooks i am not able to display this loop above categories in archive pages.

    I have the same issue with a recently viewed loop loaded using ajax but not able to make it appear below product loop.

    This is some of the code i trye to position at top and/or at the very bottom. Works ok if shop page without categories before product loop.

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

    Any idea?

    Brgds
    Rune

    #123393

    Hello,

    Please refer the plugin documentation or contact the plugin support. Our support does not cover plugins. Please note, the shop page is the functional Woocommerce page which should not be edited even with plugins.

    Best Regards

    #123398

    metuza
    Participant

    I have build the plugin myself and never had a single issue with any other theme. And we do not edit shop pages or any other page functionality.

    Brgds
    Rune

    #123415

    Artem Temos
    Keymaster

    Hi,

    Sorry, but your problem is not quite clear for us. What hook do you use? The code you sent doesn’t have any hooks.

    Kind Regards

    #123448

    metuza
    Participant

    Hello,

    Normally i am using “woocommerce_archive_description” and have now tested using “woodmart_before_shop_page” and “woocommerce_before_main_content”. I have tested with the entire range of action priorities and also tested using ajax to load content. No matter what i do the child categories are listed above my loop.

    Content like text etc. is positioned without problems so it is only the loop section that is not possible to position before the categories listed on product archive pages.

    It loads and is perfectly positioned on any archive page without child categories listed. So it seems like the categories is hooked into the loop as i when loading my loop on top get the categories then my loop, then the categories again and then the main product loop.

    I get a similar problem if i want to load my ajax based loop for recently viewed products below the main product loop, then it loads my loop above main product loop and force both loops down to just above footer area.

    This problem reminds me about problems seen now and then when a shortcode is loaded without using ob_start – ob_get_clean. Then it sometimes can be impossible to position other content correctly above or below.

    Brgds
    Rune

    #123508

    Artem Temos
    Keymaster

    Hi,

    You can check our woodmart/woocommerce/archive-product.php and see how it is organized. It has all default WooCommerec hooks so if you have a correct code it should work with our theme as well. There is no ob_* usage there.

    Kind Regards

    #123520

    metuza
    Participant

    I did find the problem in how you have setup the loop, it seems not possible to hook in between categories and products so i have to setup a separate loop for my populare products.

    Brgds
    Rune

    #123523

    metuza
    Participant

    I did find a solution. Just removed categories before my loop and added it again after my loop using these filters.
    remove_filter( ‘woocommerce_product_loop_start’, ‘woocommerce_maybe_show_product_subcategories’ );
    add_filter( ‘woocommerce_product_loop_start’, ‘woocommerce_maybe_show_product_subcategories’ );

    Works smooth.

    Brgds
    Rune

    #123545

    Artem Temos
    Keymaster

    Great that you found the solution.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Populare products on top of shop pages’ is closed to new replies.