[MARKETPRESS ECOMMERCE] How to display featured products when using custom $arg

Hi, I am currently having an issue with getting featured products using MarketPress. I have created my own $arg to get the data instead of using the shortcut as this allowed to work with the information better, but I was just wondering if there is an easy way to see if a product is featured.

Currently, I’ve created a mp_store.php file that I’ve placed under my theme’s folder and I would like it to return the products that are checked as featured products using the MP filter for products. What I need is to be able to specify that I only want the products that have the featured product box ticked and to sort them when using the MP filter.

I have not added any other custom code elsewhere.

  • Panos

    Hi there Inspired Agency ,

    You custom query should look something like this in order to fetch only featured products:

    $query = array(
    		'post_type'   => MP_Product::get_post_type(),
    		'post_status' => 'publish',
    	// Order by price
    	$query['meta_key'] = 'sort_price';
    	// Order by popularity
    	//$query['meta_key'] = 'mp_sales_count';
    	if( ! empty( $query['meta_key'] ) ){
    		$query['orderby']  = 'meta_value_num';
    		$query['order'] = 'asc'; // desc
    	// Select only featured
    	$query['meta_query'][]     = array(
    			'key'     => 'featured',
    			'value'   => '1',
    			'compare' => '=',
    	$custom_query = new WP_Query( $query );
    	while ( $custom_query->have_posts() ) : $custom_query->the_post();
    			$product = new MP_Product();
    			$product_id = $product->ID;
    			echo '<a href="' . $product->url( false ) . '">' . $product->title( false ) . '</a> <br />';
    			echo $product->display_price( false );

    Hope this helps :slight_smile:


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.