Title: stepello's Replies | WordPress.org

---

# stepello

  [  ](https://wordpress.org/support/users/stepello/)

 *   [Profile](https://wordpress.org/support/users/stepello/)
 *   [Topics Started](https://wordpress.org/support/users/stepello/topics/)
 *   [Replies Created](https://wordpress.org/support/users/stepello/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/stepello/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/stepello/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/stepello/engagements/)
 *   [Favorites](https://wordpress.org/support/users/stepello/favorites/)

 Search replies:

## Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Furgonetka.pl: Przesyłki & Narzędzia e-commerce] Problem z wtyczką po update](https://wordpress.org/support/topic/problem-z-wtyczka-po-update/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/problem-z-wtyczka-po-update/#post-18295705)
 * Dziękuję. Rozwiązało to problem  “_Ups…_** Trafiliśmy na przeszkodę ;(**”.
 * Co do błędu 503, to się nie wypowiem, bo nie korzystam z szybkiego checkoutu 
   od Furgonetki.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Furgonetka.pl: Przesyłki & Narzędzia e-commerce] Problem z wtyczką po update](https://wordpress.org/support/topic/problem-z-wtyczka-po-update/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/problem-z-wtyczka-po-update/#post-18295563)
 * Dzień dobry,
   Mam dokładnie ten sam problem w wersji 1.6.3, jeśli chodzi o “_Ups…_**
   Trafiliśmy na przeszkodę ;(**”.Poprzednio jak miałem podobny problem, okazało
   się, że blokowane były pliki cookies dla strony w przeglądarce, jednak tym razem
   odblokowanie nie pomaga. [@furgonetka](https://wordpress.org/support/users/furgonetka/)
   czy można prosić o wsparcie?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Omnibus — show the lowest price] Najniższa cena niepoprawna przy promocji starszych produktów](https://wordpress.org/support/topic/najnizsza-cena-niepoprawna-przy-promocji-starszych-produktow/)
 *  Thread Starter [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/najnizsza-cena-niepoprawna-przy-promocji-starszych-produktow/#post-17420579)
 * Cześć [@iworks](https://wordpress.org/support/users/iworks/),
 * W polu:
 * WPA -> WooCommerce -> Ustawienia -> Omnibus -> Wiadomości
 * Pole: “**Brak poprzedniej ceny**“
 * Mam ustawione “Wyświetl bieżącą cenę regularną”
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tutor LMS - eLearning and online course solution] Can’t enroll after payement](https://wordpress.org/support/topic/cant-enroll-after-payement/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/cant-enroll-after-payement/#post-17352901)
 * [@psychic9](https://wordpress.org/support/users/psychic9/)
 * I had the same problem. I wrote my solution in this post: [https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17352900](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17352900)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tutor LMS - eLearning and online course solution] Course not added to user after payment](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17352900)
 * [@jobayertuser](https://wordpress.org/support/users/jobayertuser/)
 * I am using the 2.6.0 version, and it still did not work correctly for me. 
   Are
   there any additional actions required when updating to 2.6.0 from previous version
   for it to work correctly?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tutor LMS - eLearning and online course solution] Course not added to user after payment](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17348720)
 * Since Tutor team is not very supportive with this matter, I decided to toggle
   this issue on my own and actually succeeded 😀
 * The issue took place in the first place because when customer who never made 
   order in our shop (therefore no account) started to fill in checkout fields Woocommerce
   created a draft order. Then tutor based on that order would create post (post
   type: tutor_enrolled) in wp-posts table. But since at this stage there is no 
   customer_id it would set post_author to 0. And you need to know that the enrollment
   in Tutor is dependent on this post (it needs to have type: tutor_enrolled, contain
   customer_id as post_author and have status completed, and reference correct course).
 * Since in my case customer account is created when customer presses “Order” on
   checkout, we have the customer_id at the point when order changes status. From
   there the fix is to modify 2 tutor php files:
    1. public_html/kursy/wp-content/plugins/tutor/classes/WooCommerce.php
    2. public_html/kursy/wp-content/plugins/tutor/classes/Utils.php
 * Please note the location of those files might be different in your case, but 
   it should not be an issue for you to find it 😉
 * In Woocommerce.php we modify function: enrolled_courses_status_change to this(
   change in **bold**):
 *     ```wp-block-code
       /**
            * Take enrolled course action based on order status change
            *
            * Order auto complete
            *
            * @param int    $order_id  wc order id.
            * @param string $status_from  from status.
            * @param string $status_to  to status.
            *
            * @return void
            */
           public function enrolled_courses_status_change( $order_id, $status_from, $status_to ) {
               if ( ! tutor_utils()->is_tutor_order( $order_id ) ) {
                   return;
               }
   
               $enrolled_ids_with_course = tutor_utils()->get_course_enrolled_ids_by_order_id( $order_id );
   
               if ( $enrolled_ids_with_course ) {
                   $enrolled_ids = wp_list_pluck( $enrolled_ids_with_course, 'enrolled_id' );
   
                   if ( is_array( $enrolled_ids ) && count( $enrolled_ids ) ) {
                       foreach ( $enrolled_ids as $enrolled_id ) {
                           /**
                            * If order status is processing and payment is not cash on
                            * delivery then mark enrollment as completed.
                            *
                            * Note: Order status processing simply mean customer have done
                            * payment.
                            *
                            * @since v2.0.5
                            */
                           if ( self::should_order_auto_complete( $order_id ) ) {
                               // Mark enrollment as completed.
                               tutor_utils()->course_enrol_status_change( $enrolled_id, 'completed', $order_id  );
                               // Mark WC order as completed.
                               self::mark_order_complete( $order_id );
                           } else {
                               tutor_utils()->course_enrol_status_change( $enrolled_id, $status_to, $order_id  );
                           }
   
                           // Invoke enrolled hook.
                           if ( 'completed' === $status_to ) {
                               $user_id   = get_post_field( 'post_author', $enrolled_id );
                               $course_id = get_post_field( 'post_parent', $enrolled_id );
                               do_action( 'tutor_after_enrolled', $course_id, $user_id, $enrolled_id );
                           }
                       }
                   }
               }
           }
       ```
   
 * Then in the Utils.php the change is much heavier so just compare it with what
   you already have. Function that needs modification is: course_enrol_status_change
 *     ```wp-block-code
           /**
            * Enrol Status change
            *
            * @since 1.6.1
            *
            * @param bool   $enrol_id enrol id.
            * @param string $new_status new status.
            * @param int $order_id order id
            *
            * @return mixed
            */
           public function course_enrol_status_change( $enrol_id = false, $new_status = '', $order_id = 0 ) {
               if ( ! $enrol_id ) {
                   return;
               }
   
               global $wpdb;
   
               // Get customer ID from the order
               $order = wc_get_order( $order_id );
   
               if ( $order && is_a( $order, 'WC_Order' ) ) {
                   $customer_id = $order->get_customer_id();
   
                   if ( $customer_id ) {
                       // Trigger action before the status change
                       do_action( 'tutor/course/enrol_status_change/before', $enrol_id, $new_status);
   
                       // Update post status, post author, and post modified time
                       $result = $wpdb->update(
                           $wpdb->posts,
                           array(
                               'post_status'   => $new_status,
                               'post_author'   => $customer_id,
                           ),
                           array( 'ID' => $enrol_id )
                       );
   
                       // Trigger action after the status change
                       do_action( 'tutor/course/enrol_status_change/after', $enrol_id, $new_status);
   
                       // Check and log the result
                       if ( $result === false ) {
                           error_log( "Failed to update post_author for enrol_id: $enrol_id" );
                       }
                   }
               }
           }
       ```
   
 * And that would be all. **Remember that this will be overridden when you update
   Tutor!!! **
 * I tested it with Paypal payment (order closed automatically) and bank transfer(
   manually close order) in both cases it worked correctly.
 * If someone has an idea how to implement this in functions.php of child theme,
   please let me know!
 * I had some messages exchanged with Tutor team regarding this issue, and they 
   were stating that enrollment issue is due to 100% coupon (I used that for testing)
   or price set to 0. This is not true! It’s because this entry to wp-posts table
   when woocommerce saves draft order. I’m not that used to github repos and don’t
   know how suggest it there, so please Tutor team fix it for next release, and 
   I don’t mind you using this code 😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tutor LMS - eLearning and online course solution] Course not added to user after payment](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17334836)
 * [@valuepage](https://wordpress.org/support/users/valuepage/) 
   I think your issue
   is a bit different. In our case, the issue is that the Order is visible in Tutor,
   but the student is not enrolled correctly. However, I also had similar problem
   as you (Woocommerce was showing order and Tutor not). For me the issue was fixed
   when I changed i WooCommerce Settings >> Advanced >> Featured following settings:
    - WordPress posts storage (legacy) as checked
    - High-performance order storage as unchecked
    - Enable compatibity mode as checked
    - Enable WooCommerce analitics as checked
 * Here grab a screenshot: [https://prnt.sc/pMh921nc5M7g](https://prnt.sc/pMh921nc5M7g)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Tutor LMS - eLearning and online course solution] Course not added to user after payment](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/)
 *  [stepello](https://wordpress.org/support/users/stepello/)
 * (@stepello)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/course-not-added-to-user-after-payment/#post-17333717)
 * I have exactly the same problem. 
   In my case the issue is 100% cases when user
   is registered during checkout. I the user buys the course when he already has
   an account and is logged in, it will enroll more often than not.

Viewing 8 replies - 1 through 8 (of 8 total)