mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
12 lines
402 B
Text
12 lines
402 B
Text
add_filter( 'aws_search_results_products', 'my_aws_search_results_products' );
|
|
function my_aws_search_results_products( $products ) {
|
|
usort($products, function ($item1, $item2) {
|
|
$a = intval( $item1['f_price'] * 100 );
|
|
$b = intval( $item2['f_price'] * 100 );
|
|
if ($a == $b) {
|
|
return 0;
|
|
}
|
|
return ($a < $b) ? -1 : 1;
|
|
});
|
|
return $products;
|
|
}
|