WC_Discounts::sort_by_price( array $a, array $b )
Sort by price.
Description Description
Parameters Parameters
- $a
-
(Required) First element.
- $b
-
(Required) Second element.
Return Return
(int)
Source Source
File: includes/class-wc-discounts.php
protected function sort_by_price( $a, $b ) {
$price_1 = $a->price * $a->quantity;
$price_2 = $b->price * $b->quantity;
if ( $price_1 === $price_2 ) {
return 0;
}
return ( $price_1 < $price_2 ) ? 1 : -1;
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |