WooCommerce Point Rewards on Manual Payments

Home / Code Snippets / WooCommerce Point Rewards on Manual Payments

By default, your users will get points when the order has been marked as paid. This code snippet will instead payout when an order has been marked as “Completed”. Using this codes shippet will add support for manual payments such as Check or Bank Transfer.

Add the code snippet to your child theme's functions.php file.

Last edited February 28, 2015

  1. Hello

    Can the above code be modified to deduct points for a particular kind of payment type. Specifically for anyone paying cash on collection which I have as a payment option. I don’t get my commission for those types of transactions so I would like to punish those people, punish them good! 🙂

    1. You could do this but this code snippet will not be your solution. This code snippet adjusts the instnace at which myCRED pays out rewards from when an order is “Marked as paid” to when an order is “Completed”. This code snippet will have no access to the order or what payment method you used. Instead you would need to look at the mycred_woo_reward_reference filter and stop transactions there.

      Here is an example using that filter to stop payouts if a user has paid using PayPal. You would need to find the ID of the payment gateway you want to stop and replace 'paypal' with that gateways ID.

      add_filter( 'mycred_woo_reward_reference', 'mycredpro_stop_woo_reward', 10, 3 );
      function mycredpro_stop_woo_reward( $reply, $order_id, $type ) {
      
      	// Get the WooCommerce order
      	$order = wc_get_order( $order_id );
      
      	// Stop payouts for use of PayPal
      	if ( $order->payment_method == 'paypal' )
      		return '';
      
      	return $reply;
      
      }
      
  2. Hallo,

    where do I put this code? Please write me the way. I put the code in this way? : root /web /wp-content /plugins /mycred /includes/mycred-funtcions.php
    Thank you.

    Alica

    1. All code, unless stated otherwise goes into your active theme’s functions.php file. If you are using a child theme, it goes into your child theme’s functions.php instead. Never put code into the myCRED plugin as you will loose them each time you update myCRED.

  3. Hallo Gabriel,

    I need theme AVADA. tHIS WAY: /web/wp-content/themes/Avada/functions.php – insert code here? Sorry, I m not a professional in PC. I open functions.php and I put code there. yes? Anywhere I put code? for example, at the end?
    Can I spoil my theme and web?

    Thank you

Leave a Reply