• markbautista

    (@markbautista)


    Hi Woo-Commerce Support,

    First of all we thank you for this great plugin you created. It’s plugin that meets our needs.

    I have a 1 issues on my end, Because I’m trying to do a function inside the theme functions.php to send a data to an external link when the order status completed. I use WooCommerce - Autocomplete Orders to hook on the function i have created.

    Here’s the short code i created: Now the problem with this is that i cant get the get_user_meta of a Customer who just ordered.

    
    add_action( 'woocommerce_order_status_completed', 'send_order_details' );
    function send_order_details( $order_id ){
    	global $woocommerce, $post;
    	$order = new WC_Order($order_id);
    	$member_id = get_user_meta( $user_id->ID, 'member_id' , true );
    	$orderamount = $order->get_total();
    	$points_earned = get_post_meta( $order->id, '_wc_points_earned', true );
    
    	global $wpdb, $current_user;
    	$current_user = wp_get_current_user();
    	$options = array('location' => 'https://web.com/index.php/myserver/soapServer', 'uri' => 'https://web.com/');
    	try {
    		$apiz = new SoapClient(NULL, $options);
    		$ar = array("key_code" => "", "member_id" => "$member_id", "points" =>$points_earned, "order_amount"=>$orderamount);
    		$resultMsg = $apiz->cashBackPoints($ar);
    	}
    	catch (SoapFault $exception) {
    	}
    }

    Thank you very much.

  • The topic ‘Get User Meta of an User who just ordered.’ is closed to new replies.