wc_get_min_max_price_meta_query()WC 3.0.0

Deprecated from version 3.6.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Get min/max price meta query args.

Return

Array.

Usage

wc_get_min_max_price_meta_query( $args );
$args(array) (required)
Min price and max price arguments.

Changelog

Since 3.0.0 Introduced.
Deprecated since 3.6.0

wc_get_min_max_price_meta_query() code WC 8.6.1

function wc_get_min_max_price_meta_query( $args ) {
	wc_deprecated_function( 'wc_get_min_max_price_meta_query()', '3.6' );

	$current_min_price = isset( $args['min_price'] ) ? floatval( $args['min_price'] ) : 0;
	$current_max_price = isset( $args['max_price'] ) ? floatval( $args['max_price'] ) : PHP_INT_MAX;

	return apply_filters(
		'woocommerce_get_min_max_price_meta_query',
		array(
			'key'     => '_price',
			'value'   => array( $current_min_price, $current_max_price ),
			'compare' => 'BETWEEN',
			'type'    => 'DECIMAL(10,' . wc_get_price_decimals() . ')',
		),
		$args
	);
}