Support » Plugins and Hacks » Woo Comerce- Upsells displaying randomly

  • The theme I am using is called Bonfire.

    On the single-product.php template, I want to be able to call the upsells of a product. Is there something like

    <?php woocommerce_related_products( 4, 4, 'rand' ); ?> I can do. Right now I have

    <?php get_header('shop'); ?>
    <?php do_action('woocommerce_before_main_content'); ?>
    <div class="inner-container clearfix">
    	<!--<div class="page-single page-sidebar">-->
    	<div id="product" class="clearfix">
    	<?php custom_woocommerce_single_product_content(); ?>
    	<div id="sidebar">
    	<?php dynamic_sidebar('woo-single-sidebar'); ?>
    <!-- Start UpSells Section-->
     * Up-sells
    global $product;
    $upsells = $product->get_upsells();
    if (sizeof($upsells)==0) return;
    <div class="upsellss products">
    	<h2><?php _e('Other Jugz Models&hellip;', 'woocommerce') ?></h2>
    	$args = array(
    		'post_type'	=> 'product',
    		'ignore_sticky_posts'	=> 1,
    		'posts_per_page' => 3,
    		'orderby' => 'rand',
    		'post__in' => $upsells
    	woocommerce_get_template_part( 'loop', 'shop' );
    <!--Stop UpSells Section -->
    <div class="product-tabs">
    	<?php do_action('woocommerce_after_single_product_summary'); ?>
    <?php woocommerce_related_products( 4, 4, 'rand' ); ?>
    <?php get_footer('shop'); ?>

    So as you can see on, when you refresh the page, the Other Jugz Models (3 products) randomly change. How do I get it just to show the upsells attached to the product posts?

    Thank you in advanced.

  • The topic ‘Woo Comerce- Upsells displaying randomly’ is closed to new replies.