Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created November 5, 2021 12:52
Show Gist options
  • Save andrewlimaza/4f07fe8395fe64daa394ac30d891dcad to your computer and use it in GitHub Desktop.
Save andrewlimaza/4f07fe8395fe64daa394ac30d891dcad to your computer and use it in GitHub Desktop.
Set the initial amount to $0 for existing members.
<?php
/**
* Set the initial price to $0 for members only, for any level.
*
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_adjust_initial_amount( $level ) {
if ( pmpro_hasMembershipLevel() ) {
$level->initial_payment = 0;
}
return $level;
}
add_filter( 'pmpro_checkout_level', 'my_pmpro_adjust_initial_amount' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment