LLMS_Product::is_purchasable()
Determine if the product is purchasable At least one gateway must be enabled and at least one access plan must exist If the product is a course, additionally checks to ensure course enrollment is open and has capacity
Description Description
Return Return
(boolean)
Source Source
File: includes/models/model.llms.product.php
public function is_purchasable() { // Default to true. $ret = true; // Courses must have open enrollment & available capacity. if ( 'course' === $this->get( 'type' ) ) { $course = new LLMS_Course( $this->get( 'id' ) ); $ret = ( $course->is_enrollment_open() && $course->has_capacity() ); } // if we're still true, make sure we have a purchasable plan & active gateways. if ( $ret ) { $gateways = LLMS()->payment_gateways(); $ret = ( $this->get_access_plans( false, false ) && $gateways->has_gateways( true ) ); } return apply_filters( 'llms_product_is_purchasable', $ret, $this ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: