wc_products_array_orderby_price() WC 3.0.0
Sort by price low to high.
Хуков нет.
Возвращает
Число.
Использование
wc_products_array_orderby_price( $a, $b );
- $a(WC_Product) (обязательный)
- First WC_Product object.
- $b(WC_Product) (обязательный)
- Second WC_Product object.
Список изменений
С версии 3.0.0 | Введена. |
Код wc_products_array_orderby_price() wc products array orderby price WC 5.0.0
function wc_products_array_orderby_price( $a, $b ) {
if ( $a->get_price() === $b->get_price() ) {
return 0;
}
return ( $a->get_price() < $b->get_price() ) ? -1 : 1;
}