The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Woo Comerce- Upsells displaying randomly (1 post)

  1. GeekStreetWP
    Posted 3 years ago #

    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 http://www.jugzstore.com/shop/gloss-black-grey-polarized-5059d/, 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.

Topic Closed

This topic has been closed to new replies.

About this Topic