Skip to content

Instantly share code, notes, and snippets.

@dwanjuki
Created August 21, 2025 09:40
Show Gist options
  • Save dwanjuki/fa350c3a02e8b093743bc53b770c4858 to your computer and use it in GitHub Desktop.
Save dwanjuki/fa350c3a02e8b093743bc53b770c4858 to your computer and use it in GitHub Desktop.
Customize the payment plan cost text on the level 2 checkout page
<?php
/**
* Customize the payment plan cost text on the level 2 checkout page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpropp_custom_plan_cost_text( $plan_name_raw, $plan ) {
// Bail if not a level 2 checkout.
$checkout_level = pmpro_getLevelAtCheckout();
if ( empty( $checkout_level->id ) || 2 !== (int) $checkout_level->id ) {
return $plan_name_raw;
}
// Customize the plan cost text based on the plan name.
switch ( $plan->name ) {
case 'Annual':
$plan_name_raw = 'Annual Payment – £600 plus any applicable sales tax';
break;
case 'Associate Membership':
$plan_name_raw = 'Monthly Payment – £60 plus any applicable sales tax (£720 per year)';
break;
}
return $plan_name_raw;
}
add_filter( 'pmpropp_plan_cost_text_checkout', 'my_pmpropp_custom_plan_cost_text', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment