WC_Coupon::decrease_usage_count( string $used_by = '' )

Decrease usage count for current coupon.


Description Description


Parameters Parameters

$used_by

(Optional) Either user ID or billing email.

Default value: ''


Top ↑

Source Source

File: includes/class-wc-coupon.php

	public function decrease_usage_count( $used_by = '' ) {
		if ( $this->get_id() && $this->get_usage_count() > 0 && $this->data_store ) {
			$new_count = $this->data_store->decrease_usage_count( $this, $used_by );

			// Bypass set_prop and remove pending changes since the data store saves the count already.
			$this->data['usage_count'] = $new_count;
			if ( isset( $this->changes['usage_count'] ) ) {
				unset( $this->changes['usage_count'] );
			}
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.