Noptin_EDD::get_order_customer_details( int $payment_id, bool $existing_subscriber = false )
Returns order customer details
Parameters Parameters
- $payment_id
(int) (Required) The order id.
- $existing_subscriber
(bool) (Optional) Whether this is an existing subscriber or not.
Default value: false
Return Return
(array)
Source Source
File: includes/integrations/class-noptin-edd.php
public function get_order_customer_details( $payment_id, $existing_subscriber = false ) { // Fetch the payment. $payment = new EDD_Payment( $payment_id ); if ( empty( $payment ) || empty( $payment->email ) ) { return array(); } // Prepare subscriber details. $noptin_fields = array( '_subscriber_via' => 'edd_checkout', 'payment_id' => $payment_id, 'email' => $payment->email, 'address_1' => $payment->address['line1'], 'address_2' => $payment->address['line2'], 'postcode' => $payment->address['zip'], 'city' => $payment->address['city'], 'state' => $payment->address['state'], 'country' => $payment->address['country'], 'wp_user_id' => $payment->user_id, 'first_name' => $payment->first_name, 'last_name' => $payment->last_name, ); if ( $existing_subscriber ) { unset( $noptin_fields['_subscriber_via'] ); unset( $noptin_fields['payment_id'] ); } return array_filter( $noptin_fields ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.2.6 | Introduced. |