Home › Forums › Legacy Support › Support queries › Other issues › Problem with Subscriptions part 2
- This topic has 75 replies, 3 voices, and was last updated 4 years, 6 months ago by Mk.
-
AuthorPosts
-
August 7, 2019 at 11:09 am #221412LuizBraParticipant
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 explainAugust 8, 2019 at 2:38 pm #221638Anshuman SahuKeymasterNope 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.August 8, 2019 at 2:42 pm #221639Anshuman SahuKeymasterSo im thinking maybe this code is responsible for the sudden remove of users from the courses ?August 9, 2019 at 7:44 am #221704LuizBraParticipantSorry what does it mean? do I have to implement the code that you provided?August 9, 2019 at 2:24 pm #221795MkModeratoryes, you have to add the above full code .August 12, 2019 at 9:52 am #222008LuizBraParticipantThanks 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:- How it was before the code
- How it is now with the code
- How is should be
Please let me know if something is not clearAugust 12, 2019 at 2:56 pm #222074Anshuman SahuKeymasterWell 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 .August 12, 2019 at 4:36 pm #222087LuizBraParticipantThanks, 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?August 13, 2019 at 3:07 pm #222242Anshuman SahuKeymasterWell 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 .August 13, 2019 at 3:18 pm #222244LuizBraParticipantHi 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 scenarioAugust 14, 2019 at 12:39 pm #222324Anshuman SahuKeymasteryes 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 .August 14, 2019 at 12:41 pm #222325LuizBraParticipantThis 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 caseAugust 14, 2019 at 1:17 pm #222341LuizBraParticipantAnd 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"August 16, 2019 at 10:17 am #222577Anshuman SahuKeymasterYes 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 ?August 16, 2019 at 10:52 am #222592LuizBraParticipantHi AlexYes 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? -
AuthorPosts
- The topic ‘Problem with Subscriptions part 2’ is closed to new replies.