Created
June 17, 2018 11:11
-
-
Save kreamweb/fe3a391e2a5b9b71c8f216ed90a72fbf to your computer and use it in GitHub Desktop.
use this function to get the points earned in a single order.
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 | |
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