public function decrease_purchase_count($count = 1)
{
// Make sure it's numeric and not negative
if (!is_numeric($count) || $count != absint($count)) {
return false;
}
$new_total = (int) $this->purchase_count - (int) $count;
if ($new_total < 0) {
$new_total = 0;
}
do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
if ($this->update(array('purchase_count' => $new_total))) {
$this->purchase_count = $new_total;
}
do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
return $this->purchase_count;
}