[Events +] Tiered payments

I'm using "memberships2" and "Events+" to provide events at 2 prices. Free signup members pay £5 and paying subscribers get them for free. I have it set up and the events show "default price" for free members and "0" for subscribers but when it reaches the cart stage the paid members are still being charged £5.

  • Adam Czajczyk

    Hello Joel,

    I hope you're fine today and thank you for your question!

    I have just setup Events+ with Membership 2 Pro on my test site and tried to replicate that but I wasn't able to. The prices were properly applied based on membership status (member or not and if member - member of which membership).

    Therefore, I assume it's either related to some setting of one of these plugins or it's specific to the site and needs further troubleshooting. In order to investigate it, I would like to take a closer look at your setup.

    To let me do this, would you please enable support access to it? You can enable it by going to "WPMU DEV -> Support" page in site's back-end and clicking on "Grant support access" button there.

    Once that's done, let me know here, please. Let me also know which even(s) should I check and which membership(s).

    I'll the access the site, test it on your end, compare your configuration with mine and try to replicate it again and hopefully this will let me solve that :slight_smile:

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Joel

    Thank you for granting access.

    I have checked the site and I see what I missed here (and it's a crucial part, unfortunately).

    You are using MarketPress and got Events+ set to take payments via MarketPress. That means that the actual payment for an event is a "purchase of a product". The problem is that while there is an integration between Events+ and Membership 2, there is no integration between MarketPress and Membership 2. Also, Events+ integrates with MarketPress only in that sense that it can "send client to the store" and "take info that the purchase had been made" - but it cannot "dynamically" set prices, which would be required here.

    What I tested, and what works, was a direct "Events+ <-> Membership 2 Pro" case where you set the default price in Events+ and define prices for members there, then the payment is taken via PayPal directly by Events+.

    This applies proper prices.

    There is a workaround for this, but it's a bit "complex". What could be done would be:

    1. Duplicate those events that should be available at different prices for visitors and members
    2. Use Membership 2 Pro plugin to let members access only one set of copies and non-members another one
    3. The same way - set yet another category in MarketPress and duplicate necessary products into that category (again, set prices accordingly; and use Membership 2 Pro to set appropriate access right)
    4. Finally - for events from "non-members" set of events set the "non-members" category of products as payment and for events for "members" set of events set the "members" category of products.

    I know that sounds a bit "twisted" but I hope you got my point.

    That's a bit ugly workaround but should work, though the downside might be if you are using a "limited capacity" events.

    The other option would be to just accept payments via PayPal directly through Events+ instead of MarketPress products - and that would work fine.

    Kind regards,
    Adam

  • Joel

    Ok, I think we are going to need to look for a different solution.
    Firstly they are using limited capacity events so duplicating them will mess up the total numbers available/used.
    Secondly the customer we made the website for only accepts payments via Stripe which is why we chose this set of plugins as we were told this would work. I explained what we needed before we bought the plugins. I also got the setup checked part way throught the project before we delivered the site and was told it was set up correctly.
    We're now in the position that this site has been delivered and paid for so should be "over" for us but it's not doing what it's supposed to be doing. We will now have to work on it for free to deliver what we said we would. The plugins were bought because they were supposed to do this for us.
    We were told to use this set of plugins to deliver this solution.

    So we need a method of passing the two prices to the store so that the non-subscribers are charged via Stripe.

    Kind regards,

    Karl (on behalf of Joel)
    please respond to karl@wedostories.com

  • Adam Czajczyk

    Hello Joel

    Thank you for your response!

    It seems that there might have happen a terrible misunderstanding and I deeply apologize for it. I don't know the initial talk that you are referring to but yes: Events+ can be paid with Stripe if integrated with MarketPress and Events+ does support different prices for Members with Membership 2 Pro. But not both at once. Once again, I'm sorry for that.

    Having that said, let me ask our developers if we can find some sort of "workaround" for this so you could use the Events+ the way you intended. I'm not able to give any guarantee at that point (especially that I'm not a developer) but if it's possible at all, they'll be able to come up with some solution.

    I have forwarded the question to them and am awaiting response and we'll update you here as soon as we know some more details on this.

    Kind regards,
    Adam

  • Adam Czajczyk

    Hello @joel94353!

    Our developers checked this and there's no way to make it work like that without either serious changes in both plugins' core code or custom developed additional - and quite complex - solution.

    I have also checked your pre-sales chat and I didn't see any mention of Membership 2 Pro there being used in a combination with Events+ and MarketPress and no suggestion there that those three plugin would work together like that.

    Making it work together the way you described would require, as mentioned above, a custom development. Such custom development is outside the scope of this support though :

    Custom development is outside the scope of this support:

    https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-1

    In case you needed this to be developed for you, it might be worth to post a job request on a Codeable.io site. You can also grab a nice discount for it here:

    https://premium.wpmudev.org/partners

    That being said, there is another workaround that actually might work for you, even though it's a bit different "workflow". Let me explain:

    1. MarketPress plugin supports coupon codes; such coupon codes add discount to the products
    2. You could create such codes and provide them to Members (those that should pay discounted prices for events).
    3. Coupon codes could be provided "manually" but you could actually use Membership 2 Pro too for that this way:

    - add some message with a coupon code to the event description
    - enclose that part of the even description in a membership [ms-protected-content] shortcode (see "Membership 2 -> Help -> Shortcodes" in your site's back-end)

    This way a "regular" user would go to an event, go to the MarketPress product to make payment and pay a full price. A member would go the same path but additionally would see a coupon code on event page (not visible to non-members) and could use that code during checkout to pay less.

    Kind regards,
    Adam

  • Panos

    Hi Joel ,

    Regarding your initial request perhaps we could help out here. That is for the MarketPress Event product to have the price that is set in the Event for the membership of the current user.

    As Adam explained this is not supported out of the box and needs some custom code. You could use the following as a guide :

    add_filter( 'mp_product/get_price', function( $price, $product ){
    
    	if ( ! is_user_logged_in() ) {
    		return $price;
    	}
    	$event_id = get_post_meta( $product->ID , 'eab_event_id', true );
    	$event = new Eab_EventModel( $event_id );
    
    	if ( empty( $event_id ) || ! $event instanceof Eab_EventModel ) {
    		return $price;
    	}
    
    	$member = MS_Model_Member::get_current_member();
    	$membership_ids = $member->get_membership_ids();
    
    	if ( empty( $membership_ids ) ) {
    		return $price;
    	}
    
    	$event_memebreships = get_post_meta( $event_id, 'eab_membership2', true );
    
    	if ( empty( $event_memebreships ) ) {
    		return $price;
    	}
    
    	foreach ( $membership_ids as $membership_id ) {
    
    		if (
    			isset( $event_memebreships[ $membership_id ] ) &&
    			$event_memebreships[ $membership_id ][ 'has_price' ] &&
    			isset( $event_memebreships[ $membership_id ][ 'price' ] ) )
    		{
    			$price['regular'] = $price['lowest'] = $price['highest'] = $event_memebreships[ $membership_id ][ 'price' ];
    			return $price;
    		}
    
    	}
    
    	return $price;
    }, 20, 2 );

    In my tests it worked. I have set different prices per membership in the Event. When I got booking an event, in the cart and checkout page I have the price that is set for that membership.

    You can add the above shortcode in a mu-plugin and give it go :slight_smile:

    Hope this helps!

  • Joel

    Hi Panos,
    Thanks for your help.
    I tried the mu-plugin but the result I got was that in a situation where the member type should be paying, I selected to buy a product (one of the classes on offer) and I was told I was marked as attending but nothing was added to the cart. In this scenario it was a "free signup" member who should have been paying for the class.

    The way the site is set up there are two membership levels. "Free sign up" members have signed up but pay for all their classes. "Paid member" levels have paid a subscription fee so all the classes are free. What we are trying to get to occur is that if a "Free signup" member selects a class the item is added to the cart and they pay for it. If a "Paid member" selects a class they either don't need to use the cart, or it's added to the cart at £0.

  • Panos

    Hi Joel ,

    Need to be sure that we are on the same page and testing in the same way :slight_smile:

    You have an event eg Class One. You also have 2 memberships, one free, lets say it's called "Free Membership", and one paid, called "Paid Membership".

    When a member tries to purchase the Class One, if he has the Free Membership he will pay 100$. If he has the Paid Membership he will pay 0$.

    In case member has to pay, he will have to use MarketPress' gateways.

    If this is what you need, please try the following.
    1. activate the MarketPress and the Membership2 add-ons in Events+

    2. Create a Product in MarketPress and give it a price 100$, in case someone tries to purchase it directly.

    3. Create an Event and in the Is this a paid event? option select yes. This should expand a list. First in Select a pricing Product choose the product you created. Then under that it should have a Membership 2 Prices section. Click on it to expand the memberships. In each membership add the appropriate price. In the Paid membership add price 0, as the user should not pay anything and in the Free Membership add 100.

    Here is a screenshot of my event:

    4. Make sure you have uploaded the script provided in a php file in the wp-content/mu-plugins folder.

    Now when a user with Free Membership tries to Attend this event, it should ask him to pay providing a link to MP cart with the 100$ price. The member with the Paid Membership will have 0$ price.

    Could you please let me know what is different in your tests?

    Kind regards!

  • Joel

    That's almost exactly as we are using it already. The only difference is where you have typed in a price for "Membership one" that price comes from the price added to the product for that class. We create products using "store" and assign prices then when the class event displays and uses the price it's coming from the price we set on the product. That part works fine.

    The rest is set up as you describe. Are you saying if we manually enter the price for the events instead this should work?

  • Panos

    Could you please try as you said, add the price in the Membership field?

    If it doesn't work could you please send in admin and ftp access so I could check it on your site? You can send that privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: "Attn: Panos Lyrakis"

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    - link back to this thread for reference

    Thanks!

  • Panos

    Hi Joel ,

    I can't think of a reason that this would not work for existing Events, as long as the prices are set in each Membership field as described in my previous reply.

    If you still have issues could you please send ftp and admin info so I could have a look there? Also let us know about which Event this doesn't work. In case you send this info please do not share in this thread, use the our contact form as described in my previous reply.

    Kind regards!

  • Joel

    (Karl on behalf of Joel)
    Can you check again please as I did get a confirmation email at 17:34 on 17/08/2018 that you had received the information. It read:

    Hi, Karl!

    Thank you for sending this information. I have assigned it to Panos. You should hear back from him on your support ticket shortly. If there is anything else we can do for you, please let us know! We are happy to help. :slight_smile:

    Have a wonderful weekend, Karl. :slight_smile:

    Please rate my reply:
    http://nicereply.com/wpmudev/112478?ticket=643764548/782607

    Kind Regards.
    Christy

  • Panos

    Hi Karl!

    I saw your description in the email and I could replicate same thing as well :slight_smile:

    Currently there is no hook available that would help. So, I would recommend to add a new filter in the MarketPress integration file in Events plugin, so it doesn't add the event to cart.

    So first thing you would need to do is to add this new filter to your events plugin. You can do so by replacing file
    events-and-bookings/lib/plugins/lib/class_eab_mp_bridge.php

    I'd recommend to keep a backup pf the original file before uploading new file (eg rename it to class_eab_mp_bridge.php.txt)

    After you have replaced that file you can use the new filter
    incsub_event_add_event_product_to_cart

    In that filter you can either check if the member has a specific membership and if he has return false. Or it can be used mor generic, and check if event price is zero. If it is zero then it should return false in order not to add to cart as in the following sample snippet:

    add_filter( 'incsub_event_add_event_product_to_cart', function( $add, $event_id, $user_id ){
    
    	$member = MS_Model_Member::get_current_member();
    	$membership_ids = $member->get_membership_ids();
    
    	if ( empty( $membership_ids ) ) {
    		return $price;
    	}
    
    	$event_memebreships = get_post_meta( $event_id, 'eab_membership2', true );
    
    	if ( empty( $event_memebreships ) ) {
    		return $add;
    	}
    
    	foreach ( $membership_ids as $membership_id ) {
    
    		if (
    			isset( $event_memebreships[ $membership_id ] ) &&
    			$event_memebreships[ $membership_id ][ 'has_price' ] &&
    			isset( $event_memebreships[ $membership_id ][ 'price' ] ) )
    		{
    			if ( 0 == $event_memebreships[ $membership_id ][ 'price' ] ) {
    				return false;
    			}
    		}
    
    	}
    
    	return $add;
    }, 20, 3 );

    This filter is very likely to be included in next release, so you don't need to worry if the snippet will work after update. But please check the changelog first to be sure :slight_smile:

    Hope this helps!
    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.