rcp_stripe_checkout_subscription_data

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/

Filters the subscription data passed through to the  Stripe Checkout arguments. The filtered value is an array of subscriptions, with each value being another array containing the subscription level's name, description, and a panel label.

The filter in context:

$subscriptions = array();
foreach ( rcp_get_subscription_levels( 'active' ) as $subscription ) {
	$subscriptions[ $subscription->id ] = array(
		'description' => $subscription->description,
		'name'        => $subscription->name,
		'panelLabel'  => $this->is_trial() ? __( 'Start Trial', 'rcp' ) : __( 'Register', 'rcp' ),
	);
}

$subscriptions = apply_filters( 'rcp_stripe_checkout_subscription_data', $subscriptions );

Example for modifying the "panelLabel" for each subscription level:

function ag_rcp_stripe_checkout_subscription_data( $subscriptions ) {
	foreach ( $subscriptions as $sub_id => $sub_data ) {
		$subscriptions[ $sub_id ]['panelLabel'] = __( 'Register or Renew', 'rcp' );
	}

	return $subscriptions;
}
add_filter( 'rcp_stripe_checkout_subscription_data', 'ag_rcp_stripe_checkout_subscription_data' );
Powered by Zendesk