Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/0ac2d1caf922c4a1a2c80dea0b4febc8 to your computer and use it in GitHub Desktop.
Save andrewlimaza/0ac2d1caf922c4a1a2c80dea0b4febc8 to your computer and use it in GitHub Desktop.
PMPro remove discount for non-approved members and Woo
<?php
/**
* Adjust the Woo membership discount only if the member is approved.
* This won't discount for pending or denied members.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmprowoo_price_adjust_approvals( $discount_price, $lowest_price_level, $price, $product ) {
if ( ! class_exists( 'PMPro_Approvals' ) ) {
return $discount_price;
}
// Check if the member is not approved, and if so, return the regular price.
if ( ! PMPro_Approvals::isApproved() ) {
return $price;
}
return $discount_price;
}
add_filter( 'pmprowoo_get_membership_price', 'my_pmprowoo_price_adjust_approvals', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment