Recently we had a client who was running Learnpress for an e-learning type website. This client wanted to offer a monthly subscription to customers rather than a one-time fee.
Learnpress offers a subscription plugin for this type of situation but we generally prefer the additional options available with Woocommerce Subscriptions. Woocommerce Subscriptions allows additional control over payment methods, pausing subscriptions and advanced admin controls / reports.
To get started you need the following plugins:
Step 1: Set your payment methods
Ensure your Learnpress payment method is setup as Woocommerce and you have a payment method in Woocommerce active that supports Subscriptions.
- Visit ‘LearnPress > Settings’
- Under ‘Payments’ tab, choose ‘WooCommerce Payment’ and check ‘Enable’
Step 2: Create a subscription product in Woocommerce Subscriptions.
You want to set the recurring amount to be the monthly amount and set the product to have a free trial at an interval of your choosing.
During checkout, Learnpress will charge a one-time fee, and the woocommerce subscription will charge the on-going fees.
If your monthly amount is $25, you want your learnpress course to be a one-time $25 fee and the on-going Woocommerce Subscription price to be $25 with a 30 day-free trial. The 30 day-trial will prevent any double-billing during the first month.
Step 3: Automatically add the subscription product to the cart when the Learnpress course is added.
Add this code to your functions.php file, replacing $product_id = 1563 with your own product ID. This is the product ID of your Woocommerce Subscription.
**Heads up, you may need to modify this code if you are using Woocommerce for anything other than this Learnpress course. Currently this code will add the subscription to EVERY woocommerce cart order.
Step 4: Auto Mark Processing Orders As Complete
Learnpress will only register a user through Woocommerce if the order is completed. Paypal & Stripe will sometimes (depending on your setup) leave an order on processing.
Add this to functions.php to change processing to completed
That’s it! Now when someone purchases they will automatically be setup for a Woocommerce Subscriptions. You can go even deeper and hide the cart page, shop page and make it as seamless as you want.