gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
183 stars 135 forks source link

[Access Plan] Allow custom Redirect URL after order completion #768

Closed actual-saurabh closed 5 years ago

actual-saurabh commented 5 years ago

Implemented in two phases:

Phase 1: redirect query arg on Checkout URL

Add a filter to https://github.com/gocodebox/lifterlms/blob/cdbee2b4b3bfabf3339bd6870f3d3af8e9227da0/includes/abstracts/abstract.llms.payment.gateway.php#L153 to pick up the value of any redirect parameter, validate it and redirect to that after order completion.

For memberships, automatically pick up the redirect parameter and pass it on to the checkout page. This way students could be redirected to the course from where they started on a membership only access plan.

Add a checkbox to Membership only Access Plans to toggle such redirection.

Phase 2: Custom Redirection field

Simply add a field in the Access Plan (removed when WooCommerce is active) to set a redirect exactly the same as Sales Page with the default value as the same product. Without changing the core code, simply pass the redirection url in the redirect query parameter.

Note on Membership only Access Plans

For Membership only access plans, the setting on the course access plan will always override any setting on the Membership Access Plan itself. This can only be changed using custom code.

actual-saurabh commented 5 years ago