WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Price Removal shortcode (2 posts)

  1. campru
    Member
    Posted 1 year ago #

    How can I remove the price info from 'recent products' shortcode

    http://wordpress.org/extend/plugins/woocommerce/

  2. bheadrick
    Member
    Posted 1 year ago #

    it loads the same templates as the standard products loop. (content-product.php)

    You'd pretty much need to add your own shortcode or use css to hide the price. Here's the code for that particular shortcode:

    function woocommerce_recent_products( $atts ) {
    
    	global $woocommerce_loop;
    
    	extract(shortcode_atts(array(
    		'per_page' 	=> '12',
    		'columns' 	=> '4',
    		'orderby' => 'date',
    		'order' => 'desc'
    	), $atts));
    
    	$args = array(
    		'post_type'	=> 'product',
    		'post_status' => 'publish',
    		'ignore_sticky_posts'	=> 1,
    		'posts_per_page' => $per_page,
    		'orderby' => $orderby,
    		'order' => $order,
    		'meta_query' => array(
    			array(
    				'key' => '_visibility',
    				'value' => array('catalog', 'visible'),
    				'compare' => 'IN'
    			)
    		)
    	);
    
    	ob_start();
    
    	$products = new WP_Query( $args );
    
    	$woocommerce_loop['columns'] = $columns;
    
    	if ( $products->have_posts() ) : ?>
    
    		<ul class="products">
    
    			<?php while ( $products->have_posts() ) : $products->the_post(); ?>
    
    				<?php woocommerce_get_template_part( 'content', 'product' ); ?>
    
    			<?php endwhile; // end of the loop. ?>
    
    		</ul>
    
    	<?php endif;
    
    	wp_reset_query();
    
    	return ob_get_clean();
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic