LLMS_Access_Plan::requires_payment( int $coupon_id = null )
Determine if the access plan requires payment.
Description Description
Automatically accounts for coupons, sales, trials, and whether the plan is marked as free.
Parameters Parameters
- $coupon_id
-
(int) (Optional) LLMS_Coupon ID.
Default value: null
Return Return
(bool) true if payment required, false otherwise
Source Source
File: includes/models/model.llms.access.plan.php
$ret = false;
if ( ! $this->is_free() ) {
$ret = ( $this->get_initial_price( array(), $coupon_id, 'float' ) > 0 );
// Ensure that we still collect payment details if a free trial is used.
if ( false === $ret ) {
$price_key = $this->is_on_sale() ? 'sale_price' : 'price';
$ret = ( $this->get_price( $price_key, array(), 'float', $coupon_id ) > 0 );
}
}
return apply_filters( 'llms_plan_requires_payment', $ret, $coupon_id, $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.30.1 | Uses self::get_initial_price(). |
| 3.0.0 | Introduced. |