Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Last active March 29, 2021 03:03
Show Gist options
  • Save JarrydLong/b4eb082bdbefc7dc96a05e556251957a to your computer and use it in GitHub Desktop.
Save JarrydLong/b4eb082bdbefc7dc96a05e556251957a to your computer and use it in GitHub Desktop.
<?php
/**
* This recipe will add a fee to the initial and recurring value when using Stripe
*
* 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_pmpro_checkout_level( $level ){
if( !empty( $_REQUEST['gateway'] ) ){
if( $_REQUEST['gateway'] == 'stripe' ){
$level->initial_payment = $level->initial_payment + 3; //Updates initial payment value
$level->billing_amount = $level->billing_amount + 3; //Updates recurring payment value
}
}
return $level;
}
add_filter( "pmpro_checkout_level", "my_pmpro_checkout_level" );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "3 Methods to Adjust Membership Pricing Based on Payment Gateway" at Paid Memberships Pro here: https://www.paidmembershipspro.com/adjust-membership-pricing-by-payment-gateway/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment