Forked from andrewlimaza/hide_discount_code_checkout.php
Last active
January 31, 2022 13:25
-
-
Save kimwhite/62e08bfa775d65ea8002e27378d18466 to your computer and use it in GitHub Desktop.
Hide Discount Code For Multiple PMPro Level
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
<?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