Skip to content
Docs
Get RestroPress

Filter

rpress_get_discount_code

Updated
On this page

Filters the discount code.

Runs in RPRESS_Discount::get_code() and filters the value before it is returned to the caller. This is the value used when a customer enters the code at checkout.

Available since RestroPress 1.0.6.

Parameters#

ParameterTypeDescription
$valuestringThe discount code.
$discount_idintThe discount ID.

Return value#

string. The code to use.

Example#

function my_rpress_get_discount_code( $value, $discount_id ) {
	return strtoupper( $value );
}
add_filter( 'rpress_get_discount_code', 'my_rpress_get_discount_code', 10, 2 );

Source#

Applied in:

  • includes/class-rpress-discount.php (line 705), in RPRESS_Discount::get_code()
Was this page helpful?