Course Bundles
Actions
add_action( 'stm_lms_woocommerce_order_approved', 'stm_lms_woocommerce_order_approved_function', 10, 2 );
function stm_lms_woocommerce_order_approved_function( $course_data, $user_id ) {
if ( ! empty( $course_data['bundle_id'] ) ) {
$courses = get_post_meta( $course_data['bundle_id'], \STM_LMS_My_Bundle::bundle_courses_key(), true );
if ( ! empty( $courses ) ) {
foreach ( $courses as $course_id ) {
if ( get_post_type( $course_id ) === 'stm-courses' ) {
$user_id = 444;
\STM_LMS_Course::add_user_course( $course_id, $user_id, 0, 0, false, '', $course_data['bundle_id'] );
\STM_LMS_Course::add_student( $course_id );
}
}
}
}
}Last updated
Was this helpful?

