The gateway add-ons built-in support for WooCommerce allows you to setup point reward systems where your users can earn points by purchasing products and then pay for future orders using those points. This is referred to as the Store Rewards System and is available since myCred 1.4.
You select how many points each product grants and once an order has been marked as paid, the buyer receives these points for each product in their order. The value of these points are controlled by an exchange rate, which is used to when a buyer selects to pay for a future order using points, instead of real money.
Store rewards will only work when orders are paid by a member of your website. Anonymous checkouts or checkouts where a user is not logged in to your website will not reward points! Furthermore, by default, the reward is paid out when an order is paid and not when an order gains the status “Completed”. This however can be swapped using a custom code snippet:
Rewarding Product Purchases
As soon as the Gateway add-on is enabled and WooCommerce is installed, you will find a new metabox whenever you edit a product in your wp-admin area. This new metabox will list all your currently setup point types and allow you to set a point amount that the buyer gets when purchasing each product.
Points are awarded per product so you will not be able to set a different point amount based on for example Variable products or Grouped products.
This point amount is multiplied by the quantity option. A product that is set to give 10 points will payout 20 points if the buyer selects Quantity to be 2.
As of version 1.7.6, you can set how many points you want to reward for each variation in a Variable Product. You can still use the myCred Metabox but this will reward the same amount no matter which variation a user purchases.
To set a value for each variation, edit the product and click on the “Variations” tab in the “Product Data” metabox. Click to show each variations setup and scroll down to the bottom of the tab. myCred will add in a field for all point types you have installed. If you want to reward points for a variation, enter the amount, if not, leave the field empty. Repeat for each variation and remember to click “Save Changes”!
If you DO NOT want to give points based on the variation the buyer selects, but for the product itself, use the “myCred” metabox to set the point value instead. If both are set, the variation value takes precedence.
Reward a Set Value
If you have a large number of store product, it might be a bit daunting to edit them all one by one just to set how many points they grant. Instead, you might want to look at awarding a percentage of the order total as points.
In these cases, you can instead use a custom code snippet to reward users. Here is an example where we reward users with 25% of the order value in points.
Rewarding Product Reviews
If enabled, the Gateway add-on comes with a WooCommerce product review hook. This hook can be used to reward your users with points for leaving a product review. You can find this hook on the Points > Hooks page in your admin area.
The Gateway add-on will add in a new custom gateway in your WooCommerce > Checkout settings called “myCred”. This gateway, if enabled, will allow users to pay for an order using their current point balance. If you have multiple point types, you must select to choose one point type that can be used as payment.
Based on the exchange rate you set, the gateway is automatically hidden as an option on the checkout page if the user can not afford to pay with points. This of course also means that if points are the only way to pay, there will be no payment option available and no purchases will be possible. You can change this behavior with a custom snippet like this one:
(Showing a gateway does not mean anyone can use it. The gateway will still check to make sure the customer can afford to pay using points.)
You can find the myCred Gateways settings in the same place where you edit all other gateways, on the WooCommerce > Settings page under the “Checkout” tab.
First we will need to enable the gateway and set a title. This title will be shown on the checkout page describing the payment option and in the admin area when viewing an order and how it was paid.
The customer message is the message that is shown to the user as they select this gateway on the checkout page. This is optional.
Next we need to set the log template that will be used for each payment and refund. It is important that these fields are not left empty!
Next, if our store currency is not set to be points, we need to set an exchange rate in order to know the value of our points. This exchange rate is applied to the order total.
You can select to show the cost of the order in points in the cart and / or on the checkout page. This total will be shown even if the user can not afford to pay. You can also set the label that will be used with the point amount.
Finally, the gateway gives you the option to share the profits with the product owner. This means that when a buyer pays with points, a percentage of these points are given to the product author. If the buyer does not pay with points, the product author will not receive points either!
Just like with the previous log templates, the templates for profit sharing are mandatory. Remember to always save!