woocommerce_customer_get_last_order
Filters the id of the last order from a given customer.
Usage
add_filter( 'woocommerce_customer_get_last_order', 'wp_kama_woocommerce_customer_get_last_order_filter', 10, 2 );
/**
* Function for `woocommerce_customer_get_last_order` filter-hook.
*
* @param string $last_order_id The last order id as retrieved from the database.
* @param WC_Customer $customer The customer whose last order id is being retrieved.
*
* @return string
*/
function wp_kama_woocommerce_customer_get_last_order_filter( $last_order_id, $customer ){
// filter...
return $last_order_id;
}
- $last_order_id(string)
- The last order id as retrieved from the database.
- $customer(WC_Customer)
- The customer whose last order id is being retrieved.
Changelog
| Since 4.9.1 | Introduced. |
Where the hook is called
woocommerce_customer_get_last_order
woocommerce/includes/data-stores/class-wc-customer-data-store.php 378-382
$last_order_id = apply_filters( 'woocommerce_customer_get_last_order', $last_order_id, $customer );