wc_products_array_orderby_price( WC_Product $a, WC_Product $b )
Sort by price low to high.
Description Description
Parameters Parameters
- $a
-
(Required) First WC_Product object.
- $b
-
(Required) Second WC_Product object.
Return Return
(int)
Source Source
File: includes/wc-product-functions.php
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;
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |