• Resolved triptoafsin

    (@triptoafsin)


    Hi,
    I’m using the 1.7 version of tutor lms, My issue is my users don’t get enrolled even if they complete their payment. I’m using woocommerce as my payment gateway. Yes i’ve completed the order manually and tried to replace line 49 and 50 –

    with this code –
    add_action(‘woocommerce_new_order’, array($this, ‘course_placing_order_from_admin’), 10, 1);

    add_action(‘woocommerce_thankyou’, array($this, ‘course_placing_order_from_customer’), 10, 1);

    on the woocommerce.php

    I’m in dire need of this solution

    Thanks i advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @triptoafsin,
    You need to create an instance/object of order, to access the data.

    add_action('woocommerce_thankyou', array($this, 'course_placing_order_from_customer'), 10, 1);
    public function course_placing_order_from_customer($item_id, $item, $order_id) { //<--check this line
    
        //create an order instance
        $order = wc_get_order($order_id); //<--check this line
    
        $paymethod = $order->payment_method_title;
        $orderstat = $order->get_status();
    
        if (($orderstat == 'completed') && ($paymethod == 'PayPal')) {
            echo "something";
        } 
        elseif (($orderstat == 'processing') && ($paymethod == 'PayPal')) {
    
            echo "some other shit";
        } 
        elseif (($orderstat == 'pending') && ($paymethod == 'PayPal')) {
            echo "some other shit";
        }
    }

    Hope this helps!

    • This reply was modified 5 years, 8 months ago by Rejuan Ahamed.
    Thread Starter triptoafsin

    (@triptoafsin)

    Thanks for your reply @rejuancse
    Would you please mention where should I create the instance? is it in the woocommerce.php?

    and payment method is selected as paypal in your piece of code, i can change to anything else right?

    after creating this object will my users be able to enroll in the course right?

    I got a solution,

    You need to Check Both “Vitual” and “Downloadable” along with “For Tutor” to the product

    and it will be working fine .. .

    Enjoy !

    Thread Starter triptoafsin

    (@triptoafsin)

    @faheemraza sadly this solution didn’t work for me.

    Thanks for the help anyways

    Hello @triptoafsin,
    woocommerce.php is perfect, you can easily use this code.
    Please try it, I hope your problem will be solved.

    Thanks

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

The topic ‘Registerd Users Don’t get Enrolled’ is closed to new replies.