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


Top ↑

Return Return

(array)


Top ↑

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 );
	}

Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.6Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation