Changing Fluent Form recurring subscription text

tdrayson

When building SnippetClub, I wanted to change the subscription summary text under the membership plan.

Current output

Preferred output

At the time of writing this, there was no documented filter. (27/08/2022)

I went hunting in the source code to try and find something that would allow me to override the text. I managed to find the hook fluentform_recurring_payment_summary_texts

You can find all the cases below. Remove or change them to your liking.


        <?php

/*
* tct_recurring_text
*
* @function Changes recurring subscription text under payment plan
* @author Taylor Drayson
* @since 27/08/2022
* @link https://snippetclub.com/changing-fluent-form-recurring-subscription-text/
*/
function tct_recurring_text($cases) {
	$cases['has_signup_fee'] = '{first_interval_total} for first {billing_interval} then {subscription_amount} for each {billing_interval}';
	$cases['has_trial'] = 'Free for {trial_days} days then {subscription_amount} for each {billing_interval}';    		$cases['onetime_only'] = 'One time payment of {first_interval_total}';
	$cases['normal'] = '{subscription_amount} for each {billing_interval}';
	$cases['bill_times'] = ', for {bill_times} installments';
	$cases['single_trial'] = 'Free for {trial_days} days then {subscription_amount} one time';
	
	return $cases;
}
add_filter( 'fluentform_recurring_payment_summary_texts', 'tct_recurring_text', 10, 2 );
      
Copy

Add the filter to your functions.php or code snippet plugin.

Hook Location

FluentFormPro\Payments\PaymentHelper.php -> getPaymentSummaryText()

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise