get (logged in) users previous order details

WPPizza – A WordPress Plugin Support Code Snippets (read only) get (logged in) users previous order details

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9799

    Olly
    Admin & Mod

    if you need to get some info about a logged in users previous orders you can do/add the following as to where required (as of wppizza 2.11.8.14)

    
    
    	/**add and instanciate the class*/
    	require_once(WPPIZZA_PATH.'classes/wppizza.user.details.inc.php');
    	$userdetails=new WPPIZZA_USER_DETAILS();
    	
    	/*set the user id - in this case "1112" */
    	$userdetails->setUserId(1112);
    	
    	/***
    		get details as needed
    	***/
    	/*get a total count of all completed orders of this user*/
    	$ordercount=$userdetails->getUserOrderCount();
    	/*do something with $ordercount*/
    	
    	/*get an array of all gateways the user has used when ordering */
    	$gateways=$userdetails->getUserOrderGateways();
    	/*do something with $gateways*/
    	
    	/**get total order value of all orders of this user*/
    	$total=$userdetails->getUserOrderTotal();
    	/*do something with $total*/
    
    
Viewing 1 post (of 1 total)

The topic ‘get (logged in) users previous order details’ is closed to new replies.