How do I use pricing tables with M2?

I want to use a pricing tables plugin with membership 2 Pro and so I am trying to find a url to go to individual sign up pages for my plans. I ahve looked at the forum which suggests adding this to the register page:


but that doesn't work for me.

Any suggestions?


  • Predrag Dubajic

    Hey @Chris,

    Hope you're doing well today :slight_smile:

    I believe that suggestion was regarding previous version of Membership and since the plugin has been completely rewritten with version 2.0 this will no longer work.

    You can now add shortcode for subscription buttons, like this:
    [ms-membership-buy id="1684" label="Buy now!"]
    Where 1684 is the ID of membership you want to link to, and you can find the ID by going to Membership 2 > Memberships panel and see the ID in far right column on that page.

    After you add that you should see button that will link to something like:

    Let us know if this works for you :slight_smile:

    Best regards,

  • Predrag Dubajic

    Hey Chris,

    Awesome, glad to hear we got that sorted out :slight_smile:

    As for the coupon we could use a bit of jquery to populate the coupon field.
    Add this code to your child theme functions.php file, or create new php file in your wp-content/mu-plugins/ folder and paste the code there but add <?php before code:

    function custom_populate_coupon() { ?>
    <script type="text/javascript">
        jQuery( document ).ready(function() {
            jQuery('#coupon_code').val(jQuery('#coupon_code').val() + 'COUPON');
    <? }
    add_action( 'wp_footer', 'custom_populate_coupon' );

    Replace COUPON with your coupon code and that should be it.

    Best regards,

  • Chris

    Hi - sorry , I've actually just noticed the original problem has not been resolved. If I set up the link above when I am logged in, it does take me to the single membership sign up page. However, if I am not logged in (as my customers would not be) it takes me to the list of all memberships, which I then need to choose and register before ending up on the single membership sign up page.

    Is it to do with how I have set up my registration page?

  • Adam Czajczyk

    Hey Chris,

    I hope you're well today!

    This seems to be a default behavior as your content isn't accessible for outsiders, thus they're being forced to register and the main registration page (at "Membership 2" -> "Settings" -> "General" page) is set to "Register" page.

    To override it I think you'd need to force users to create an account first. However, I'm sure there also should be another way around so I'm calling our 2nd-line support for a helping hand here.

    Hopefully, they'll be able to provide us with a quick fix here! Please note though that their response time might be a bit longer than ours here on forum.

    Keep an eye on this thread for further updates and information!


  • Vinod Dalvi

    Hi Chris,

    Could you please try using the attached small plugin containing the following code to make the shortcode ms-membership-buy work for non logged in users?

    function add_custom_ms_buy_scripts(){
    	if( !is_user_logged_in() ){
    	<script type="text/javascript">
    		var ms_memberships_page = 'memberships'; // Add memberships page slug here
    		var ms_register_page = 'register'; // Add register page slug here
    			var ms_buy_url = jQuery('.ms-membership-buy').attr('href');
    			var ms_buy_url2 = ms_buy_url.replace(ms_register_page, ms_memberships_page );
    			ms_buy_url += '&do-login=1&redirect_to='+ms_buy_url2+'&ms_membership_buy=true';
    			jQuery('.ms-membership-buy').attr('href', ms_buy_url);
    		if( is_page() && isset($_GET['ms_membership_buy']) ){?>
    				<script type="text/javascript">
    					jQuery('.ms-membership-form-wrapper .ms-form-price-boxes,').remove();
    		<?php }
    add_action('wp_footer', 'add_custom_ms_buy_scripts', 99);

    Best Regards,
    Vinod Dalvi