When you're running a membership site there might be cases when you need to sell your users points that they'll be able to use to buy merch or anything else you may be selling.
Good news: you can do that with MyCRED and WooCommerce!
What you'll need for this guide
Setting up WooCommerce and MyCred
You've probably already heard about WooCommerce since it's a very well known eCommerce plugin suite for WordPress. Start by downloading it for free from the WordPress plugins repository and activating it.
MyCRED, as the name says, is a plugin that offers you the possibility to have a points system. You can award your users with points and badges when they perform certain actions, or reach a certain number of a particular action (for example: watching a video in your membership training area). Download, install and activate the free MyCRED core plugin to get started.
The core MyCRED plugin is free but there are also paid add-ons that extend the functionality of MyCRED, provide various integrations (such as with MemberPress), etc.
Your members can then use these points in a number of ways, including spending them on your physical or digital products within WooCommerce.
But before spending any points, members first have to somehow buy or earn them. In this tutorial, we'll show you how users can buy points through WooCommerce and bypass the default cart functionality in WooCommerce to make the experience more seamless for your members.
Luckily, WooCommerce and MyCRED have a direct integration, so we don't really need to do anything special for this first part of the guide.
How to give WooCommerce buyers myCRED points
So let's see how to give points with WooCommerce products.
You have to edit your product or to add a new one and on the edit page, you should have a box in the top-right part of your page. A box looking like this:
You have to tick the “Reward with Points” box and an input field should appear. There what you have to do is to put how many points should the user receive when they will buy your product. And then you just have to publish it. The top-right box should look like this when the option is ticked.
Note that this method will also work for free WooCommerce products. It doesn't matter whether the product is purchased with a positive dollar amount, or is “purchased” at $0, so long as the product is technically bought by the user.
How to bypass the WooCommerce checkout flow
But what happens if you want to have this functionality without having to create a product page or to bother your users with a cart page for a few points purchase?
As you may already know, WooCommerce works has a default workflow with a product page -> cart page -> checkout page. Let's see how to skip the first 2 pages and get our user directly to the checkout page.
Since we don't have an option for that inside WooCommerce's settings by default, we have to add some custom code to our WordPress installation. And the easiest way to do that is to paste the following code to your theme's functions.php file.
Please make sure that you have a child theme and that you are not doing the edits in the main theme, you might lose everything with the next theme update. Here is an article about “How to create a Divi child theme” written by my colleague Dositej, which is about Divi, but the method can be applied to any WordPress theme.
Here is the code that you have to paste in your theme's functions.php file:
And also we would need a link for the product purchase, we can add that link anywhere, to a button, to a Call-To-Action, etc. Here is how the link should look like:
x
Of course, we replace “memberfix.rocks” with your website's address and “1337” with your product id number.
Now we should be all set with the link and with the setup. If you visit your page and press the buy button it should take you directly to the checkout page.
Video tutorial
Please let us know in the comments section if you have any questions or you have a different method to do this.
Very helpful article. Thank you for posting it! 🙂
Our pleasure! 🙂
This is exactly what I wanted to achieve. Thx!
Do you have a working website of how it looks like?
Hi Rohan,
Unfortunately, we don’t have a working example. This was done in a testing environment and it was erased a while ago.
But in the front end, it looks exactly like a regular Woocomerce site, or if that’s not how you want it you can customize it in the way you prefer it, you just have to use that product link that I described in the article.
And in the back end, it looks pretty much like in the video I attached to the article.
Your code is no longer displayed. Please check. Could you share it here once again? Thanks! I really would like to check it out on a mycred WooCommerce install I am working on now! Thanks.
Hi Josh,
The code is on the webpage, at least on my end. I tried on a few different terminals and the code shows up.
Here is a link to the original Pastebin page where you can get the code:
https://pastebin.com/Db1xzuU8
Thanks!