RCP_Registration

The RCP_Registration class is used on the registration page for setting up the registration, applying discounts, applying fees, and calculating the total price. In most cases you will want to use the rcp_get_registration() function to retrieve the current, main instance of the registration object.

$registration = new RCP_Registration( $level_id, $discount_code );

The class has the following public methods:

set_subscription( $subscription_id )

Used for setting the subscription ID for the registration. If the subscription level being added has a fee, that is automatically applied as well.

get_subscription()

Returns the subscription level ID the registration is for.

add_discount( $code, $recurring = true )

Adds a discount to the registration. The recurring flag specifies whether the discount code should apply to all future payments or only the first payment.

get_discounts()

Returns an array of discount codes that have been applied, or false if none.

add_fee( $amount, $description = null, $recurring = false, $proration = false )

Adds a fee to the registration. The parameters are as follows:

  • $amount (float) - Amount of the fee.
  • $description (string) - Description of the fee (i.e. "Signup Fee").
  • $recurring (bool) - Whether or not the fee should be applied to all future payments.
  • $proration (bool) - Whether or not this is a proration credit being applied.

Example:

$registration = rcp_get_registration();
$registration->add_fee( 50, __( 'Extra Signup Fee', 'rcp' ) );

get_fees()

Returns an array of all fees that have been applied to the registration, or false if none.

get_total_fees( $total = null, $only_recurring = false )

Returns the total amount of fees that have been applied to the registration.

get_signup_fees()

Returns the total amount of signup fees that are being applied. This does not include proration credits or recurring fees.

get_proration_credits()

Returns the total amount of proration credits being put towards the registration.

get_total_discounts( $total = null, $only_recurring = false )

Returns the total amount of discounts.

get_total( $discounts = true, $fees = true )

Returns the total initial price (with or without discounts/fees, depending on parameters).

get_recurring_total( $discounts = true, $fees = true )

Returns the recurring total (with or without discounts/fees, depending on parameters).