Skip to content
Docs
Get RestroPress

Filter

rpress_payment_discounts

Updated
On this page

Filters the discount codes of a payment.

Applied when the discounts property of an RPRESS_Payment is read. The filter runs on every read of the property, not only when the payment is loaded.

Parameters#

ParameterTypeDescription
$discountsstring|arrayThe discount codes stored on the payment.
$payment_idintID of the payment.
$paymentRPRESS_PaymentThe payment object.

Return value#

string|array. The discounts to return.

Example#

function my_payment_discounts( $discounts, $payment_id, $payment ) {
	return $discounts;
}
add_filter( 'rpress_payment_discounts', 'my_payment_discounts', 10, 3 );

Source#

Applied in:

  • includes/payments/class-rpress-payment.php (line 2190), in RPRESS_Payment::get_discounts()
Was this page helpful?