Support » Plugin: Easy Digital Downloads - Simple eCommerce for Selling Digital Files » Suggestion to improve API export data

  • Resolved sminozzi

    (@sminozzi)


    Hi,

    Great plugin, congratulations.

    We need to get the IP number of our customers to get their country.

    We suggest to include, if possible, this line in file class-edd-api-v2.php
    $sales[‘sales’][ $i ][‘ip’] = $payment->ip;

    I know we can get this info in downloads but some products don’t require a download.

    I guess many people will like it.

    Cheers,
    Bill

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @sminozzi

    Kindly use below code snippet to get IP address in EDD API

    function _edd_api_sales( $sales, $data ) {
    	
    	if( !empty( $sales['sales'] ) ) {
    		foreach ( $sales['sales'] as $sale_key => $sale_data ) {
    
    			$payment = new EDD_Payment( $sale_data['ID'] );
    
    			if( $payment ) {
    				$sales['sales'][ $sale_key ]['ip'] = $payment->ip;
    			}
    		}
    	}
    
    	return $sales;
    }
    add_filter( 'edd_api_sales', '_edd_api_sales', 10, 2 );

    Please add above code snippet to your theme / child theme functions.php file

    Thread Starter sminozzi

    (@sminozzi)

    Hi @pratik-jain,

    Works fine! Thanks a lot.
    5 stars plugin, 5 stars support!
    🙂

    Cheers,
    Bill

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion to improve API export data’ is closed to new replies.