Problem with Subscriptions part 2

Home Forums Legacy Support Support queries Other issues Problem with Subscriptions part 2

Viewing 15 posts - 31 through 45 (of 76 total)
  • Author
    Posts
  • #221412
    LuizBra
    Participant
    remove_action('woocommerce_order_status_cancelled',array($obj,'bp_course_disable_access'),10,1);
    No we don't have this code. What this code does? We just added it to the functions.php but please explain
    #221638
    Anshuman Sahu
    Keymaster
    Nope this is not the proper code . the full code is : add_action('init','remove_cancel_order_course_check2'); function remove_cancel_order_course_check2(){   $obj = BP_Course_Action::init();  remove_action('woocommerce_order_status_cancelled',array($obj,'bp_course_disable_access'),10,1); }   In wplms when order status is changed to cancelled then the access to course is revoked from the user . So this ahove code stops that revoking access to course.
    #221639
    Anshuman Sahu
    Keymaster
    So im thinking maybe this code is responsible for the sudden remove of users from the courses ?
    #221704
    LuizBra
    Participant
    Sorry what does it mean? do I have to implement the code that you provided?
    #221795
    Mk
    Moderator
    yes, you have to add the above full code .  
    #222008
    LuizBra
    Participant
    Thanks Mk! We tested the code. There are small improvements! Let me explain: What I did  We have 4 courses on the site. I create a subscription product that contains 3 courses. The student already has the access to all 4 courses. So the student added to a card the subscription product and went to the checkout and did not finish it. Now, let's compare 3 states once the order that contains subscription product is cancelled:
    1. How it was before the code
    2. How it is now with the code
    3. How is should be
    How it was before the code In this scenario the student would lose an access to all 4 courses that she has How it is now with the code The student loses an access to 3 courses (that contains in the subscription product). But still has the access to a course that was not part of the product. How is should be The student suppose to still have the access to all 4 courses because she already has an access to them
    Please let me know if something is not clear
    #222074
    Anshuman Sahu
    Keymaster
    Well ok now we understand you are selling courses individually as well as with subscrition bundle as well. The issue is that our wplms woo subscriptions integration is not compatible with multiple courses .It act as same for all the courses connected with the subscription product .It removes access and gives access all the course altogether . This is a limitation of this . The ideal way should the order should not gets cancelled on its own . The order should remain in the processing status of the user which you may delete later .  
    #222087
    LuizBra
    Participant
    Thanks, Alex, yes we are selling courses individually as well as the subscription bundle. If you we have to do anything manually then it's not a scalable solution. Which I think goes against the WPLMS vision. How can you fix this?
    #222242
    Anshuman Sahu
    Keymaster
    Well we analysed a solution for this but that solution is way to heavy for your  website and it may actually crash the site when a user's subscription is being expiring . There are various checks we have to put for this . First we will have to fetch all product ids connected to a course , after that we need to fetch all orders created by the user for those product ids (which is a very heavy query) after that we need to fetch last order from all orders which has matching line item same as the product id . After that we fetch order completion data after that fetch user expiry time set for the course and compare the order completion date with it to decide whether to expire the course for the user or not .   We have adhoc setttings to adjust user expiry from course admin as well from where your can adjust user's subscription for now . Plus if you are able to stop the failed orders from being cancelled , it would also prevent the issue .
    #222244
    LuizBra
    Participant
    Hi Alex, sorry I'm not sure that I understand most of what you wrote since it's a bit more technical. If the subscription order is cancelled can we simply make a check if a user has an access to any courses and keep/not remove them? For some reason everything works fine for the normal products in the same scenario  
    #222324
    Anshuman Sahu
    Keymaster
    yes we can remove this check in the addon which removes the user from course if the subscriptions gets cancelled . But it will affect the secnario when user cancels his subscription on his own , he wont be removed from course .
    #222325
    LuizBra
    Participant
    This makes sense, Alex. But there should be a way to distinguish when an order cancelled manually and when automatically. Can you please check this? I would be really surprised if that's not the case
    #222341
    LuizBra
    Participant
    And I think if a user cancel the subscription manually then it should be fine. Let's say a user bought a subscription for 1 year. Now she has an access for 365 days. If she cancel the subscription after a purchase (let's say in 10 days) she would  have a "pending cancelation status" and she still suppose to have an access for the rest 355 days because she already paid for them. After 355 days she would have "Cancelled subscription"  
    #222577
    Anshuman Sahu
    Keymaster
    Yes there is one way and we modified the code according to it also . But it is still not working . Now if you allow us to remove the cancelled check for all , we will modify the code at your site ?
    #222592
    LuizBra
    Participant
    Hi Alex
    Yes there is one way and we modified the code according to it also .
    What if the code is just not correct at the moment? Maybe we should focus on the best idea and tried different solutions?
    Now if you allow us to remove the cancelled check for all , we will modify the code at your site ?
    Could you please tell me more about this? All my orders would not have the cancelled status from now on? What are the pitfalls?
Viewing 15 posts - 31 through 45 (of 76 total)
  • The topic ‘Problem with Subscriptions part 2’ is closed to new replies.