Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/62e08bfa775d65ea8002e27378d18466 to your computer and use it in GitHub Desktop.
Save kimwhite/62e08bfa775d65ea8002e27378d18466 to your computer and use it in GitHub Desktop.
Hide Discount Code For Multiple PMPro Level
<?php
/**
* Hide discount code link on checkout for a specific levels Paid Memberships Pro.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* Visit www.paidmembershipspro.com for more info.
*/
function pmpro_hide_discount_level() {
global $pmpro_pages;
$levels_hide = array( 1,2); //Change to any membership level IDsyou want to hide discount from.
// Remove discount fields if checkout level is defined.
if( is_page( $pmpro_pages['checkout'] ) && ( in_array( $_REQUEST['level'], $levels_hide ) ) ) {
?>
<style type="text/css">
#other_discount_code_p{ display:none; }
.pmpro_payment-discount-code{ display:none; }
</style>
<?php
}
}
add_action( 'wp_footer', 'pmpro_hide_discount_level' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment