Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter wpbuild

    (@wpbuild)

    Thread Starter wpbuild

    (@wpbuild)

    figured out the problem.

        if( adverts_request( 'price_min' ) ) {
    
            $args["meta_query"] = array(
            	'relation' => 'OR',
    	        array(
        	        'key' => 'adverts_price',
            	    'value' => adverts_filter_money( adverts_request( 'price_min' ) ),
                	'compare' => '>=',
                	'type' => 'DECIMAL(12,2)'
            	),
            	array(
                	'key' => 'adverts_price',
                	'compare' => 'NOT EXISTS'
            	)
            );
        }
    
        if( adverts_request( 'price_max' ) ) {
            $args["meta_query"] = array (
            	'relation' => 'OR',
            	array(
                	'key' => 'adverts_price',
                	'value' => adverts_filter_money( adverts_request( 'price_max' ) ),
                	'compare' => '<=',
                	'type' => 'DECIMAL(12,2)'
            	),
            	array(
                	'key' => 'adverts_price',
                	'compare' => 'NOT EXISTS'
            	)
            );
    
        }
    
    • This reply was modified 5 years, 6 months ago by wpbuild.
    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    thanks for posting your solution this seems to be the best way to do that.

    I am marking this thread as resolved then, maybe someone will find it helpful in the future :).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to include empty price in search results?’ is closed to new replies.