Membership 2 Pro: Price info in Unsubscribe table does not reflect coupon discount

Hi there,
I created a test account with a coupon that discounted it by 90% from $40 to some 30 cents. When i went to unsubscribe, I noticed the price line in the unsubscribe box did not reflect my discount:

  • Ash

    Hi there

    Please try the following code:

    add_filter( 'ms_membership_price', 'ms_membership_price_cb', 10, 2 );
    function ms_membership_price_cb( $price, $membership ) {
    	if( is_user_logged_in() ) {
    		$user_id = get_current_user_id();
    		$args = array(
    			"orderby" => ID,
    			"order" => DESC,
    			"meta_query" => array(
    				"status" => array(
    					"key" => status,
    					"value" => array(
    						"0" => billed,
    						"1" => pending,
    						"2" => paid,
    						"3" => denied,
    					"compare" => IN,
    			"posts_per_page" => -1,
    			"offset" => 0,
    		$items = MS_Model_Invoice::get_invoices( $args );
    		foreach( $items as $item ) {
    			if( $item->user_id == $user_id ) {
    				$price = $item->total;
    		$currency = $item->currency;
    		$price = $item->currency . ' ' .MS_Helper_Billing::format_price( $item->total );
    	return $price;

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.