Issue with Membership 2 Pro add-on Pro-Rating

I'm testing with the Stripe Subscriptions Gateway on the "Membership 2" plugin. I have the 'ProRate' add-on enabled. When an existing test user moves from one membership to another, it upgrades like it should, which is good. But it still charges the regular price when upgrading, and does not pro-rate by taking out the old price of previous membership. The same is true if I enable "Multiple-Memberships" add-on, though I prefer not to have it on.

Maybe I am missing a setting here. Because I can click to upgrade other memberships and they mention that they are pro-rating!!! It seems to be only certain ones (Prepared Special) pro-rate is not showing... Is there a setting I'm missing?

On a side note: at the "GetCyberSecured" plan. There lies an error with the plugin. The test user is currently on a yearly plan, but when switching to that monthly plan, it 'says' that it will reduce the monthly rate by $17 every month! It's supposed to reduce the 1st monthly payment by $17!

  • Predrag Dubajic

    Hey Carmelo,

    Hope you're doing well :slight_smile:

    I was doing a test on my installation and I couldn't see issues with pro rating as it was showing the correct, reduced price.
    I then registered new account on your site and there it worked fine as well, you can see from below screenshot that first payment was $17 and when I switched to $127 plan I was billed $100:

    Could you tell me which memberships you were testing with and perhaps exact steps I could follow so I can see the issue in action?

    On a side note: at the "GetCyberSecured" plan. There lies an error with the plugin. The test user is currently on a yearly plan, but when switching to that monthly plan, it 'says' that it will reduce the monthly rate by $17 every month! It's supposed to reduce the 1st monthly payment by $17!

    Hmm, yeah, it looks like that future recurring payments are not properly calculated with Pro Rate enabled, I was able to replicate this as well and it's even visible on the above screenshots I provided.
    I have created bug report for this issue and forwarded it to our developers.

    Best regards,
    Predrag

  • Carmelo

    Ok, I think I found the issue with prorate not working. The problem was that in the "membership 2" plugin, 3 out of 4 or so memberships were showing pro-rating. The one membership that does not show pro-rating has no out of the ordinary settings to prevent pro-rating.

    To troubleshoot, I essentially duplicated the non-pro-rating membership into a new membership, and it correctly works and pro-rates... However, what breaks the pro-rating for any particular membership is what seems like a bug in the plugin. Another note, If this is the second membership signup (Making 2 pending signups), the pro-rating starts working again; only appears to stop working if it's the only membership you've clicked into to buy; Update- It almost appears random actually, with the majority of the time pro-rating not working...

    To join a specific membership, I allow people to click a shortcode link that generates a link like "https://website.com/memberships/?membership_id=xxxx" (generated with [ms-membership-buy id="xxxx" label="Upgrade Account To The $97/yr. XXXX Plan."] ). Once this happens (gets clicked at least once by anyone), the pro-rating features of this specific membership specified in the shortcode disappears and never reappears for some reason, even on the membership list. Essentially, it seems using this shortcode will break pro-rating for a membership level.

    Next test later tonight I'll do is to test using a link to register to a specific membership level like:
    https://website.com/register/?membership_id=xxx

    Do you have any idea when a fix for the pro-rating (the other bug from earlier) from yearly to monthly will be fixed? This is a pretty serious one that I have to wait to be fixed to have a properly functioning membership, as I'm sure others do to.

  • Carmelo

    So after some more troubleshooting, there are 2 issues that I can keep replicating, both related to pro-rating in the "Membership 2" plugins:

    1. Pro-rating when moving from one membership to another does not work when a user clicks a link either:
    - Generated by 'ms-membership-buy' shortcode
    - Direct Links to the membership signup like https://website.com/register/?membership_id=xxxx

    It does pro-rate if you INITIALLY pick a membership from within the membership list page by clicking it's 'change' button (I notice that clicking the 'change' button generates the price listing and url differently...). However, clicking the 'change' button after clicking a short-code or direct link before ever clicking the membership list button seems to break pro-rating most of the time.

    2. When pro-rating does work and a user decides to move from a yearly membership to a monthly membership, it 'says' it will take the yearly rate off of every monthly payment (instead just the 1st month's or so like it really should).

    Please let me know some good news soon as this has effectively stopped me from launching this membership site.

  • Predrag Dubajic

    Hi Carmelo,

    Thanks for the detailed explanation about the setup and steps, by following these I was able to replicate the other issue as well.

    Switching price applying to each month is already reported with my previous report and I have now added other issue in the bug list as well.

    I don't have any ETA at the moment but I have notified plugin devs about both of them and hopefully they will be able to find a quick fix for those.

    Best regards,
    Predrag

    • Carmelo

      Here is something I did. I made a plugin to show the change membership buttons (and buy button) with a shortcode as a simple-ish workaround:

      <?php
      /*
      Plugin Name: Membership2 helper
      Description: Custom plugin that makes Membership 2 have a button to upgrade membership or buy into a membership if multiple memberships is enabled in add-on
      Version: 1
      Author: Camelo
      Author URI: https://coolwebsite.com/
      Requires at least: 4.0
      Domain Path: /languages
      */
      
      // Shorcode to add submit *signup* button for membership2
      // ex) [m2_buy_link id="1MembershipID"]
      function m2_buy_link_func($atts) {
          $GetNonce = wp_create_nonce( 'membership_signup' );
          extract(shortcode_atts(array(
              "id" => '',
              "label" => ''
          ), $atts));
          return '<form action="https://yourwebsite.com/memberships/" class="ms-membership-form" method="post">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="'.$GetNonce.'">
        <input type="hidden" name="_wp_http_referer" value="/memberships/">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="membership_id" name="membership_id" value="'.$id.'">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="action" name="action" value="membership_signup">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="step" name="step" value="payment_table">
        <button class="wpmui-field-input button ms-signup-button membership_signup wpmui-submit button-primary" type="submit" id="submit" name="submit" value="">'.$label.'</button>
      </form>';
      }
      add_shortcode("m2_buy_link", "m2_buy_link_func");
      
      // Shorcode to add submit *upgrade* button for membership2, great for pro-rating
      // ex) [m2_move_link from_id="oldMembsID" to_id="newMembsID" label="Upgrade"]
      function m2_move_link_func($atts) {
          $GetNonce = wp_create_nonce( 'membership_move' );
          extract(shortcode_atts(array(
              "from_id" => '',
      	    "to_id" => '',
      	    "label" => ''
          ), $atts));
          return '<form action="https://yourwebsite.com/memberships/" class="ms-membership-form" method="post">
        <input type="hidden" id="_wpnonce" name="_wpnonce" value="'.$GetNonce.'">
        <input type="hidden" name="_wp_http_referer" value="/memberships/">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="membership_id" name="membership_id" value="'.$to_id.'">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="action" name="action" value="membership_move">
        <input class="wpmui-field-input wpmui-hidden " type="hidden" id="step" name="step" value="payment_table">
        <input class="wpmui-field-input wpmui-hidden " id="move_from_id" name="move_from_id" value="'.$from_id.'" type="hidden">
        <button class="wpmui-field-input button ms-signup-button membership_move wpmui-submit button-primary" type="submit" id="submit" name="submit" value="">'.$label.'</button>
      </form>';
      }
      add_shortcode("m2_move_link", "m2_move_link_func");

      To use to update a membership, (showing the same single blue buttons shown on the memberships page) the following example updates from membership ID 123 to 456:

      [m2_move_link from_id="123" to_id="456" label="This is the upgrade button for 123 to 456"]

      Perhaps there is a better way to do the above with some more custom code, but the issue here is that you need to know the current plan a user is in before you can upgrade them to another plan. Passing these two membership id's "from" and "to" is how Membership 2 triggers and calculates pro-rating.

      To use to just show a buy only button, follow the example below to buy a membership with id of 789:

      [m2_buy_link id="789" label="Buy into membership 789"]

      Also, to make this work, the URL that says https://yourwebsite.com/memberships/ in the code above, change that to your membership's listing page's url. Plugin needs to post to that page.

      I use this simple plugin live. Hope this helps.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.