Skip to content
Docs
Get RestroPress

Action

rpress_customer_post_decrease_purchase_count

Updated
On this page

Fires after a customer's purchase count is decreased.

Fires in RPRESS_Customer::decrease_purchase_count() after the update attempt. The first argument is the object's current purchase count, which is unchanged if the update failed.

Parameters#

ParameterTypeDescription
$purchase_countintThe customer's purchase count after the change.
$countintThe amount the purchase count was decreased by.
$customer_idintThe customer ID.
$customerRPRESS_CustomerThe customer object.

Example#

function my_customer_post_decrease_purchase_count( $purchase_count, $count, $customer_id, $customer ) {
	if ( 0 === (int) $purchase_count ) {
		delete_option( 'my_vip_customer_' . $customer_id );
	}
}
add_action( 'rpress_customer_post_decrease_purchase_count', 'my_customer_post_decrease_purchase_count', 10, 4 );

Source#

Fired from:

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

See also#

Was this page helpful?