Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Hide Paid Memberships Pro billing address fields and make them optional. Meant to be used with the Braintree gateway.
add_action('pmpro_checkout_before_submit_button', 'my_pmp_jquery');
function my_pmp_jquery() {
global $current_user;
if ($current_user->user_login) {
//script will hide billing fields and prefill name and email from WP account
jQuery( document ).ready(function($) {
var fname = '<?php echo $current_user->user_firstname; ?>';
var lname = '<?php echo $current_user->user_lastname; ?>';
var user_email = '<?php echo $current_user->user_email; ?>';
$('select[name=bcountry]').parent().hide(); //no id in some versions
$('#bemail').prop('disabled', 'true'); //disable changing email here if you know they are logged in
}); //ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.