Last active
July 2, 2019 22:33
-
-
Save andrewlimaza/414e4cf9712d25a57c73919bf1f72825 to your computer and use it in GitHub Desktop.
Stop users from changing membership level on checkout on WooCommerce
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 | |
/** | |
* Stop existing members from changing levels when purchasing a product on WooCommerce. | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function woo_dont_apply_level_for_existing_members() { | |
if ( pmpro_hasMembershipLevel( '1' ) ) { | |
remove_action( 'woocommerce_order_status_completed', 'pmprowoo_add_membership_from_order' ); | |
} | |
} | |
add_action( 'woocommerce_order_status_completed', 'woo_dont_apply_level_for_existing_members', 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment