Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created June 17, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreamweb/fe3a391e2a5b9b71c8f216ed90a72fbf to your computer and use it in GitHub Desktop.
Save kreamweb/fe3a391e2a5b9b71c8f216ed90a72fbf to your computer and use it in GitHub Desktop.
use this function to get the points earned in a single order.
<?php
function get_total_user_point( $order ) {
$user_id = false;
if ( !$order instanceof WC_Order ) {
$order = wc_get_order( $order );
}
$user_id = $order->get_user_id();
if( $user_id ){
$points = get_user_meta( $user_id , '_ywpar_user_total_points', true );
return $points;
}
return '';
}
echo get_total_user_point( ORDER_ID );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment