rtec_payments_discounts
is a filter for dynamically adding or changing discounts right before checkout.
Usage
<?php add_filter( 'rtec_payments_discounts', 'function_name', 10, 2 ); ?>
Parameters
$discounts – (array) Discount items including calculated discount and label.
$payment_data – (array) Data associated with the registration, event, and payment.
$line_items – (array) Line items including cost, label, and quantity.
Changelog
Pro
2.0 – introduced
Example: Give a Discount if Registering for More Than Three
function ru_fourth_guest_discount( $discounts, $payment_data, $line_items ) {
$fourth_guest_discount_label = 'Fourth Guest Discount';
$has_four_guests = $line_items['event']['quantity'] > 3;
if ( $has_four_guests ) {
$discounts['event'][] = array(
'label' => $fourth_guest_discount_label,
'calculated' => 25
);
}
return $discounts;
}
add_filter( 'rtec_payments_discounts', 'ru_fourth_guest_discount', 10, 3 );