BP_REST_Learndash_Courses_Endpoint::is_purchasable( WP_Post $post )
Check the course is purchasable or not.
Description
Parameters
- $post
-
(Required) Object of wp_post.
Return
(bool)
Source
File: bp-integrations/learndash/classes/class-bp-rest-learndash-courses-endpoint.php
public function is_purchasable( $post ) {
$type = $this->bp_rest_learndash_get_course_meta_setting( $post->ID, 'course_price_type' );
$price = (float) $this->bp_rest_learndash_get_course_meta_setting( $post->ID, 'course_price' );
switch ( $type ) {
case 'subscribe':
case 'paynow':
case 'closed':
$is_paid = empty( $price ) ? false : true;
break;
default:
$is_paid = false;
}
return $is_paid;
}
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.