Skip to content
Docs
Get RestroPress

Filter

rpress_is_discount_single_use

Updated
On this page

Filters whether a discount can be used only once per customer.

Runs when the single-use flag of a discount is read, in both RPRESS_Discount::get_is_single_use() and RPRESS_Discount::is_single_use(). The filtered value is cast to bool before it is returned.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$is_single_useboolWhether the discount is limited to one use per customer.
$discount_idintThe discount ID.

Return value#

bool. Whether the discount is single use.

Example#

function my_is_discount_single_use( $is_single_use, $discount_id ) {
	return $is_single_use;
}
add_filter( 'rpress_is_discount_single_use', 'my_is_discount_single_use', 10, 2 );

Notes#

Fired from two methods with the same arguments.

Source#

Applied in:

  • includes/class-rpress-discount.php (line 975), in RPRESS_Discount::get_is_single_use()
  • includes/class-rpress-discount.php (line 1501), in RPRESS_Discount::is_single_use()
Was this page helpful?