shshanker
11/20/2015 - 8:11 AM

// Multiple meta_query

// Multiple meta_query

<?php
function product_price_loop( $priceArray ) {
					
					$arr = array( 'relation' => 'OR' );
						/*$output['output'] = print_pre($arr);
						return $output;	*/
					foreach( $priceArray  as $key => $value ) { 

						$price_range = explode( '-',  $value );
						# code...
						$arr[$key] =  array(
				            'key' => '_regular_price',
				            'value' => array( $price_range[0], $price_range[1] ),
				            'compare' => 'BETWEEN',
				            'type' => 'NUMERIC'
				        );
					}

					return $arr;
				}
				
			$args['meta_query'] = product_price_loop( $pram['product_price'] );

?>