Membership 2 Pro: Change the "You will make X payments of X" Text

I would like to make some changes to the text which appears near the bottom of the checkout page, usually it says something like:

You will make 12 payments of USD 40.00, one each 4 weeks

But I have a few issues with this. One is that my client finds the phrasing to be intimidating and would like to change it. Two is that I'd prefer a form like $40 US to USD 40.00.
Incidental to this, I'd also like to have more control over how this page renders, to add some text explaining the coupon code process, to put all of my checkout buttons on one line (using my theme's responsive grid, if possible) and to apply my theme's button styles to the stripe pay button.

Please advise,

  • Ash

    Hello there

    I hope you are doing good and thanks for asking the question.

    For changing the wording, would you please try the following code:

    add_filter( 'ms_model_relationship_get_payment_description', 'ms_model_relationship_get_payment_description_cb', 99, 3 );
    function ms_model_relationship_get_payment_description_cb( $desc, $membership, $payment_type ) {
        if ( $membership->pay_cycle_repetitions > 1 ) {
            $desc = '<br>' . 'YOUR CUSTOM MESSAGE HERE';
        }
        return $desc;
    }

    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.

    This is great that you have made the coupon code text using css.

    About the other styling, would you please show me a mockup like demo or any design? I will check if that's can be easily done.

    Have an awesome day!

    Cheers
    Ash

  • uxwebtech

    Thanks Ash, that filter was very helpful. Can I placed variables in the text? for example something like:
    $desc = '<p>' . ' You will pay ' . $amount . ' a total of ' . $times . ' times'

    About Coupons: Can I use a filter to inject my own values into $coupon_message for the default case?

    Regarding styling: See screenshot below: I'd like the blue stripe button to use theme styles, like the other two buttons, which means changing that button's class attributes. I'd also like access to the html output of the buttons in general, so that I can rearrange the table cells, put the buttons in my theme's responsive grid, etc.

  • Ash

    Hello @bennyp

    Please go to /plugins/membership/app/model/class-ms-model-relationship.php line no 1850 to 1855 and replace

    return apply_filters(
    			'ms_model_relationship_get_payment_description',
    			$desc,
    			$membership,
    			$payment_type
    		);

    with

    return apply_filters(
    			'ms_model_relationship_get_payment_description',
    			$desc,
    			$membership,
    			$payment_type,
                            $invoice,
                            $short
    		);

    Do not worry about the changes, this changes will be included in next update.

    Now use the following code:

    add_filter( 'ms_model_relationship_get_payment_description', 'ms_model_relationship_get_payment_description_cb', 99, 5 );
    function ms_model_relationship_get_payment_description_cb( $desc, $membership, $payment_type, $invoice, $short ) {
        // Do your stuff here
    
        return $desc;
    }

    And now, you have everything you need, just follow the function get_payment_description() in /plugins/membership/app/model/class-ms-model-relationship.php line no 1694, and reformat your text :slight_smile:

    About the button styling, please try the following:

    .stripe-button-el{
        background: none !important;
    }
    .stripe-button-el span{
        background: none !important;
        color: #f09380 !important;
        text-shadow: none !important;
        font-weight: normal !important;
    }

    You can add this to a theme's stylesheet, in a child theme, or using a plugin like My Custom CSS.

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

    Cheers
    Ash

  • uxwebtech

    Thanks Ash, that's gangbusters.

    I just want to clarify for myself and for onlookers:

    And now, you have everything you need, just follow the function get_payment_description() in /plugins/membership/app/model/class-ms-model-relationship.php line no 1694, and reformat your text :slight_smile:

    Does this mean to paste in lines 1694-1858 and replace the relevant strings? or is there a more direct approach?

  • Ash

    Okay, I am giving you final code.

    First make the changes as follows:

    return apply_filters(
                'ms_model_relationship_get_payment_description',
                $desc,
                $membership,
                $payment_type,
                $this,  // subscription
                $invoice,
                $short
            );

    Now try the following code: http://pastebin.com/qNHSGstj

    And before using, change your wording to anything you want :slight_smile:

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

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.