Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Krishna

    (@kingswp)

    Thank you very much @bisratlearn and @smbhatia03 for your quick reply.

    I added action hooks for “woocommerce_payment_complete_order_status_processing” & “woocommerce_payment_complete_order_status_completed” but they were never triggered by WC upon successful payment and completion of order.

    Only “woocommerce_payment_complete” hook got triggered.

    One follow-up question I have is, in my case “woocommerce_payment_complete” hook got triggered only once i.e., after successful payment and order status is ‘completed’. Will this always be the case as I see @smbhatia03 mention that “but before the hook applies, WooCommerce is going to change the order status either to processing or completed”?
    Does it mean “woocommerce_payment_complete” hook might be triggered twice – once when the order status is “processing” and once when order status “completed”? How can I simulate for order status status is “processing” to ensure I have covered this case as well?

    Thread Starter Krishna

    (@kingswp)

    Dear WP Team – Requesting you to please help clarify my above questions related to reset the WordPress database queries and object cache. Thank you

    Thread Starter Krishna

    (@kingswp)

    Thank you very much @bcworkz and @lucymtc for your replies.

    I had some success with splitting this into small batches.

    @lucymtc – Regarding your statement “run your script in batches and reset the WordPress database queries and object cache on each batch to free up memory”, requesting you to please clarify the below:

    1. Reset the WordPress database queries: Why do we need to do this and what api can be used to achieve this? Would calling this lead to performance degradation?
    2. Reset object cache: Is this to clear the cached results of queries executed by WP? And this can be achieved by calling wp_cache_flush() function right? Would calling this lead to performance degradation?
    Thread Starter Krishna

    (@kingswp)

    Dear @largbasket / Tutor LMS Team ,

    Thank you very much for your reply.

    We offer a package of courses to our students via custom registration page and as part of that registration we need to create the WC order and we cannot have students themselves purchase individual courses.

    I have worked-around this issue by calling the below 2 functions (from tutor’s WooCommerce class) after creating the order and things seems to be working fine – courses are getting enrolled.

    Please let me know if the below fix can cause any other issue OR if there is a better way to fix this issue.

    $tutorWC->course_placing_order_from_admin( $order_id );
    $tutorWC->enrolled_courses_status_change( $order_id, 'pending', 'completed' );
    • This reply was modified 2 years, 11 months ago by Krishna.
    • This reply was modified 2 years, 11 months ago by Krishna.
    Thread Starter Krishna

    (@kingswp)

    Hi,
    Thank you for the reply. I tried to create the order as a user with ‘Administrator’ role, the products are added to WC order and the order status also shows as ‘Completed’, but the Tutor LMS Pro enrollments are not getting created and hence the user is unable to see any courses when login to the site.

    • This reply was modified 3 years, 6 months ago by Krishna.
Viewing 5 replies - 1 through 5 (of 5 total)