WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Getting Problem with Upsell feature (1 post)

  1. ultimate wp coders
    Member
    Posted 1 year ago #

    In my site, I'm getting problem with upsells product. It showing same price for all upsell products and the price is similar to main product.
    I used this code ...

    <?php
    	global $product;
    	$upsells = $product->get_upsells();
    	if (sizeof($upsells)==0) { ?>
    	<h2>None Yet</h2>
    	<p> Stay tuned for great pairings with this product </p>
    	<?php
    	 return;
    	 } {
    	?>
    		<?php
    		$args = array(
    			'post_type'	=> 'product',
    			'ignore_sticky_posts'	=> 1,
    			'posts_per_page' => 4,
    			'no_found_rows' => 1,
    			'orderby' => 'rand',
    			'post__in' => $upsells
    		);
    		query_posts($args);
    		//woocommerce_get_template_part( 'loop', 'shop' );
    			echo '<ul class="products">';
    			if(have_posts()) : while(have_posts()) : the_post();
    			if($product->min_variation_price) {
    				$display = $product->min_variation_price;
    			} else {
    				$display = $product->regular_price;
    			}
    			?>
    			<li class="product <?php
    				if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
    					echo 'last';
    				elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )
    					echo 'first';
    				?>">
    
    				<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
    
    				<div class="visual">
    					<a>">
    						<?php the_post_thumbnail(array(180,220)); ?>
    					</a>
    				</div>
    				<span class="material"><?php the_title(); ?></span>
    				<div class="buy">
    				<?php
    					if($product->min_variation_price) {
    						$display = $product->min_variation_price;
    					} else {
    						$display = $product->regular_price;
    					}
    				?>
    					<span class="price"><?php echo '$'.$display; ?></span>
    					<a>" class="add-to-bag">details</a>
    				</div>	
    
    			<?php
    			endwhile; endif;
    			echo '';
    		wp_reset_query();
    		?>
    	<?php } ?>


    [Please use the code buttons - as is, your code may have been damaged]

    Please help

    @ultimate wp coders - Bump deleted - please see: http://codex.wordpress.org/Forum_Welcome#No_Bumping - if you need faster help, you should consider hiring someone.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by ultimate wp coders
  • This topic is not resolved
  • WordPress version: 3.5

Tags

No tags yet.