Skip to content

Instantly share code, notes, and snippets.

@WPprodigy
Created May 28, 2018 19:02
Show Gist options
  • Save WPprodigy/9a4b18ed496943d70d6da220fc43c57d to your computer and use it in GitHub Desktop.
Save WPprodigy/9a4b18ed496943d70d6da220fc43c57d to your computer and use it in GitHub Desktop.
Grant 100 extra points for every successful checkout.
<?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