• Resolved Sarathlal N

    (@sarathlal)


    I need to get customer billing address in either customer API response or sales API response. How get those details in API response.

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

    Default EDD rest API doesn’t have billing address in either customer API response or sales API response.

    EDD is created with Hooks and Filters so you can use it and modify the response of the API or you can create your own API end point as well.

    Thread Starter Sarathlal N

    (@sarathlal)

    Here is the solution for other EDD users.

    add_filter('edd_api_sales', 'th26t_edd_api_sales_callback', 99);
    function th26t_edd_api_sales_callback($response){
        if(!empty($response) && isset($response['sales']) && is_array($response['sales'])){
            foreach($response['sales'] as $index => $sale){
                $id = $sale['ID'];
                $payment = new EDD_Payment($id);
                $response['sales'][$index]['address'] = $payment->address;
            }
        }
        return $response;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How get Customer billing address in API endpoint’ is closed to new replies.