• In the “Tutor LMS Pro > Settings > Email > Email to Students”, I have turned on “Course Enrolled”, “Completed a Course” switches.

    When we create WooCommerce Order containing a product associated with a course, the course enrollment email is sent twice to the subscriber/student.

    Note: But when we enroll the student through WP Admin UI (“WP Admin > Tutor LMS Pro > Enrollment > Enroll a Student”), the email is sent only once to the student.

    Following is the code that creates and saves the order.

    $order = wc_create_order(array('customer_id'=>$userId));
    update_post_meta( $order->get_id(), '_is_tutor_order_for_course', true );    
    $products = wc_get_products( array( 'status' => 'publish', 'limit' => -1 ) );
    foreach($products as $product) {
    	$order->add_product($product, 1);
    }    
    $order->calculate_totals();
    $order->set_status( 'completed' );
    $order_id = $order->save();
    • This topic was modified 1 year, 9 months ago by Krishna.
Viewing 1 replies (of 1 total)
  • Dear @kingswp

    We apologize for the inconvenience you’re experiencing. The email and manual enrollment features are available in Tutor LMS Pro, which is a paid version of the plugin. Please note that the wp.org forum is intended for free products, and for assistance with the Pro version, we kindly request you to contact us through our support portal at https://www.themeum.com/support/. When reaching out to us, please provide your order number so that our team can assist you more effectively. Thank you for your understanding.

Viewing 1 replies (of 1 total)
  • The topic ‘Course Enrollment email sent twice when WC Order created by code’ is closed to new replies.