Fix WooCommerce deactivation handler #952
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@shewa12, the problem that this change fixes is:
Even if WooCommerce Monetization is not used, when WooCommerce gets deactivated, Tutor LMS currently adds a permanent banner at the top of the admin dashboard which only gets cleared when WooCommerce gets re-activated.
The only trick to get around this right now is to deactivate tutor, then deactivate/uninstall WooCommerce, and the re-activate tutor again, and to get the idea for this trick, you have to study the source code deeply.
Fix:
The WooCommerce deactivation handler shall only act when monetize_by === 'wc':
Fix: When the WooCommerce plugin gets deactivated, do not disable other possible monetization methods like Paid Memberships Pro (pmpro) or EDD.
Fix: When the WooCommerce plugin gets deactivated, and WooCommerce was not enabled in Tutor LMS: - Do not show a notice saying that paid courses would have been made free and to enable WooCommerce monetization to fix this.