Skip to content

Instantly share code, notes, and snippets.

@gabrielmerovingi
Last active February 10, 2024 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmerovingi/f435a50a76e9608b38fb to your computer and use it in GitHub Desktop.
Save gabrielmerovingi/f435a50a76e9608b38fb to your computer and use it in GitHub Desktop.
By default myCRED will payout points for WooCommerce orders when an order has been marked as "paid". This means that no points will be paid out if a users pays using a manual gateway such as Check or Bank Transfers. This code snippet will force myCRED to payout when an order has been marked as "Completed" instead of paid.
/**
* Adjust myCRED Point Rewards
* Will move the points payout from when an order is "paid" to when
* an order is "completed".
* @version 1.0
*/
add_action( 'after_setup_theme', 'mycred_pro_adjust_woo_rewards', 110 );
function mycred_pro_adjust_woo_rewards() {
remove_action( 'woocommerce_payment_complete', 'mycred_woo_payout_rewards' );
add_action( 'woocommerce_order_status_completed', 'mycred_woo_payout_rewards' );
}
@Alica12
Copy link

Alica12 commented Oct 5, 2016

Hallo Gabriel, where do I put this code. Please write me the way.
Thank you.

@Shreyanshharsora
Copy link

You can put this code in function.php of your main theme or the function.php of your chield theme the best practices is to put code in your child theme so any new updates want affect the code

@Jacky29lin
Copy link

could i change the status from complete to order processing
how should i modified bellow code
remove_action( 'woocommerce_payment_complete', 'mycred_woo_payout_rewards' );
add_action( 'woocommerce_order_status_completed', 'mycred_woo_payout_rewards' );

@jabaco
Copy link

jabaco commented Nov 3, 2017

Hello, I have my site hosted in Wpengine. When I try the point rewards in the staging site (no cache) the point rewards work perfectly, but when I try it in the live site which have the robust WPengine cache system, then the points are not rewarded when purchasing a product.

I contact WPengine and they told me to ask the developer what is the name of the cookie or cookies involved in the point rewards functionality so that they can exclude them from cache and see it the points are given.

Thanks a lot for this great plugin!

@UgooAgbams
Copy link

This works have way.
When a set value is entered as reward point, let say, 100 point, and the customer on the time of placing an order, entered quantity higher than one, it does not multiply the value of point to be giving. But rather, rewards with just that entered value, irrespective of the quantity.
Any solution for this.

@iadminwpJ
Copy link

Hi, does this also work on WooCommerce Subscription?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment