Created
May 28, 2018 19:02
-
-
Save WPprodigy/9a4b18ed496943d70d6da220fc43c57d to your computer and use it in GitHub Desktop.
Grant 100 extra points for every successful checkout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Grant 100 extra points for every successful checkout. | |
*/ | |
add_action( 'woocommerce_checkout_order_processed', 'wc_test_add_points', 10, 3 ); | |
function wc_test_add_points( $order_id, $posted_data, $order ) { | |
WC_Points_Rewards_Manager::increase_points( $order->get_user_id(), '100', 'customer-checkout-out' ); | |
} | |
add_filter( 'wc_points_rewards_event_description', 'wc_test_event_description', 10, 3 ); | |
function wc_test_event_description( $event_description, $event_type, $event ) { | |
if ( $event_type === 'customer-checkout-out' ) { | |
$event_description = 'Extra Checkout Points'; | |
} | |
return $event_description; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment