Created
March 15, 2021 12:31
-
-
Save JarrydLong/d86011542e7e6cb0ed48c52764bc9c4b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Hide the discount code field on checkout for specific levels | |
* | |
* 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 mypmpro_showhide_discount_code(){ | |
global $pmpro_show_discount_code; | |
if( !empty( $_REQUEST['level'] ) ){ | |
if( in_array( $_REQUEST['level'] , array( 9, 10 ) ) ){ //Change 9, 10 to different leves | |
$pmpro_show_discount_code = false; | |
} | |
} | |
} | |
add_action( 'wp', 'mypmpro_showhide_discount_code' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment