|
@@ 694-710 (lines=17) @@
|
| 691 |
|
* |
| 692 |
|
* @return float Amount of the lowest price |
| 693 |
|
*/ |
| 694 |
|
function give_get_lowest_price_option( $form_id = 0 ) { |
| 695 |
|
if ( empty( $form_id ) ) { |
| 696 |
|
$form_id = get_the_ID(); |
| 697 |
|
} |
| 698 |
|
|
| 699 |
|
if ( ! give_has_variable_prices( $form_id ) ) { |
| 700 |
|
return give_get_form_price( $form_id ); |
| 701 |
|
} |
| 702 |
|
|
| 703 |
|
if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) { |
| 704 |
|
// Backward compatibility. |
| 705 |
|
$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
| 706 |
|
$low = ! empty( $prices ) ? min( $prices ) : 0; |
| 707 |
|
} |
| 708 |
|
|
| 709 |
|
return give_maybe_sanitize_amount( $low ); |
| 710 |
|
} |
| 711 |
|
|
| 712 |
|
/** |
| 713 |
|
* Retrieves most expensive price option of a variable priced form |
|
@@ 721-738 (lines=18) @@
|
| 718 |
|
* |
| 719 |
|
* @return float Amount of the highest price |
| 720 |
|
*/ |
| 721 |
|
function give_get_highest_price_option( $form_id = 0 ) { |
| 722 |
|
|
| 723 |
|
if ( empty( $form_id ) ) { |
| 724 |
|
$form_id = get_the_ID(); |
| 725 |
|
} |
| 726 |
|
|
| 727 |
|
if ( ! give_has_variable_prices( $form_id ) ) { |
| 728 |
|
return give_get_form_price( $form_id ); |
| 729 |
|
} |
| 730 |
|
|
| 731 |
|
if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) { |
| 732 |
|
// Backward compatibility. |
| 733 |
|
$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
| 734 |
|
$high = ! empty( $prices ) ? max( $prices ) : 0; |
| 735 |
|
} |
| 736 |
|
|
| 737 |
|
return give_maybe_sanitize_amount( $high ); |
| 738 |
|
} |
| 739 |
|
|
| 740 |
|
/** |
| 741 |
|
* Returns the price of a form, but only for non-variable priced forms. |