LLMS_Access_Plan::get_price( string $key, array $price_args = array(), string $format = 'html', LLMS_Coupon|int|null $coupon = null )
Getter for price strings with optional formatting options
Parameters Parameters
- $key
-
(string) (Required) Property key.
- $price_args
-
(array) (Optional) array of arguments that can be passed to
llms_price().Default value: array()
- $format
-
(string) (Optional) format conversion method [html|raw|float].
Default value: 'html'
- $coupon
-
(LLMS_Coupon|int|null) (Optional) Coupon ID, object, or
nullif no coupon is being used.Default value: null
Return Return
(mixed)
Source Source
File: includes/models/model.llms.access.plan.php
if ( $coupon ) {
return $this->get_price_with_coupon( $key, $coupon, $price_args, $format );
}
$price = $this->get( $key );
if ( $price <= 0 ) {
$ret = $this->get_free_pricing_text( $format );
} else {
$ret = parent::get_price( $key, $price_args, $format );
}
/**
* Filter the access plan's price.
*
* @since 3.40.0
*
* @param mixed $ret Returned price.
* @param string $key The key of the price property.
* @param array $price_args Price arguments.
* @param string $format Price format string.
* @param LLMS_Access_Plan $this Instance of the access plan.
*/
return apply_filters( 'llms_plan_get_price', $ret, $key, $price_args, $format, $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.40.0 | Added $coupon parameter. |
| 3.23.0 | Unknown. |
| 3.0.0 | Introduced. |