Skip to content
Docs
Get RestroPress

Filter

rpress_customer_decrease_value

Updated
On this page

Filters the amount subtracted from a customer's lifetime value.

Runs in RPRESS_Customer::decrease_value() before the amount is subtracted from the stored purchase_value. The result is floored at zero, so the value never goes negative.

Parameters#

ParameterTypeDescription
$valuefloatThe amount to subtract.
$customerRPRESS_CustomerThe customer object.

Return value#

float. The amount to subtract from the customer lifetime value.

Example#

function my_customer_decrease_value( $value, $customer ) {
	return abs( (float) $value );
}
add_filter( 'rpress_customer_decrease_value', 'my_customer_decrease_value', 10, 2 );

Notes#

Unlike the increase filter, the returned value is not cast with floatval() before use, so return a number.

Source#

Applied in:

  • includes/class-rpress-customer.php (line 507), in RPRESS_Customer::decrease_value()

See also#

Was this page helpful?