Last active
April 4, 2021 03:36
-
-
Save kimcoleman/ccfeeaddd998f2acf5e177d5cb18b7b2 to your computer and use it in GitHub Desktop.
Simplify paid level checkouts by removing Account Information section and generating username and password.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simplify paid level checkouts by removing Account Information section and generating username and password. | |
* You must be capturing full Billing Information for this recipe to work. | |
*/ | |
/** | |
* Hide the Account Information Section | |
*/ | |
function simple_checkout_hide_account_information_section( $skip_account_fields, $current_user ) { | |
if ( empty( $current_user->ID ) ) { | |
$skip_account_fields = 1; | |
} | |
return $skip_account_fields; | |
} | |
add_filter( 'pmpro_skip_account_fields', 'simple_checkout_hide_account_information_section', 10, 2 ); | |
/** | |
* Unset required account fields, we'll use Register Helper to require our new fields. | |
*/ | |
function my_required_user_fields( $pmpro_required_user_fields ) { | |
unset( $pmpro_required_user_fields['username'] ); | |
unset( $pmpro_required_user_fields['password'] ); | |
unset( $pmpro_required_user_fields['password2'] ); | |
unset( $pmpro_required_user_fields['bconfirmemail'] ); | |
return $pmpro_required_user_fields; | |
} | |
add_filter( 'pmpro_required_user_fields', 'my_required_user_fields', 10, 2); | |
/** | |
* Don't include the "confirm email" field in Billing Information | |
*/ | |
add_filter( 'pmpro_checkout_confirm_email', '__return_false' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Increase Conversion Rates with a Simplified Checkout" at Paid Memberships Pro here: https://www.paidmembershipspro.com/increase-conversion-rates-with-a-simplified-checkout/