wc_get_customer_last_order()WC 2.6.0

Get info about customer's last order.

No Hooks.

Return

WC_Order|true|false. Order object if successful or false.

Usage

wc_get_customer_last_order( $customer_id );
$customer_id(int) (required)
Customer ID.

Changelog

Since 2.6.0 Introduced.

wc_get_customer_last_order() code WC 9.4.2

function wc_get_customer_last_order( $customer_id ) {
	$customer = new WC_Customer( $customer_id );

	return $customer->get_last_order();
}