Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JarrydLong/d86011542e7e6cb0ed48c52764bc9c4b to your computer and use it in GitHub Desktop.
Save JarrydLong/d86011542e7e6cb0ed48c52764bc9c4b to your computer and use it in GitHub Desktop.
/**
* 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