private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count)
{
give_undo_purchase(false, $this->ID);
// Decrease store earnings
if (true === $alter_store_earnings) {
give_decrease_total_earnings($this->total);
}
// Decrement the stats for the customer
if (!empty($this->customer_id)) {
$customer = new Give_Customer($this->customer_id);
if (true === $alter_customer_value) {
$customer->decrease_value($this->total);
}
if (true === $alter_customer_purchase_count) {
$customer->decrease_purchase_count();
}
}
}