• Resolved Jack

    (@jack1132132)


    Hello,

    I’m setting up pmpro using woocommerce as gateway to purchase the memberships. As woocommerce doesn’t allow recurring payments, I’m guessing enabling ‘recurring subscription payment.’ on memberships purchased wouldn’t work, so I’ve setup instead in expiration settings for the membership to expire.

    My question is, if the user purchases two of the same memberships, would the time on said membership to expire double? Lets say a user purchases Membership Premium which expires in 4 weeks, and after 1 week the user would purchase the same membership, how much time left to expire would the membership have: 4 weeks, or 7 weeks ?

    Additionally, I’m setting discounted memberships for longer periods. Can I setup lets say three memberships for 1 month, 2 months and 3 months, with higher discounts for longer periods ? And can I purchase a 2 month discounted membership while holding a 1 month membership and the expire time accumulate on top of what’s left from the 1 month membership ?

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I use PMPro with WooCommerce and have recurring payments set up. It’s certainly possible.

    Thread Starter Jack

    (@jack1132132)

    @boxhamster hello,

    That’s great, I also plan to use recurring payments.

    If someone renews their subscription on your website, does the plan length accumulate with the leftover from the current plan?

    Thank you.

    I my case, it runs until a user cancels.

    if they want to sign up again, it’s like they were a new customer.

    Plugin Author Andrew Lima

    (@andrewza)

    If you are using expiration dates, members that renew their same level will have their remaining time of the current period added onto their next period.

    For example if a member renews a yearly level 30 days before their expiration, their renewal should state that their new expiration date is 395 days (365 days + 30 days).

    For recurring subscriptions, the customer won’t have to ever renew. They may cancel at any point in time and signup again to restart their subscription.

    Thread Starter Jack

    (@jack1132132)

    @andrewza Hello,

    In regards to recurring subscriptions, does the client still have the option to renew in advance?

    Also, so as to allow accumulating time between plans of different discounts and lengths I implemented the following code:

    
    function pmprowoo_checkout_level_custom($custom_level){
    	
    	extract($custom_level);
    	
    	if( is_premium_member( $user_id ) && in_array($membership_id, premiumMembershipIds()) && !pmpro_hasMembershipLevel($membership_id, $user_id)){
    		
    		$memberships = pmpro_getMembershipLevelsForUser($user_id, false);
    		
    		if(count($memberships) !== 1)
    			return $custom_level;
    		else
    			$membership = $memberships[0];
    		
    		global $wpdb;
    		
    		$sqlQuery = $wpdb->prepare(
    				"SELECT startdate, enddate
    				FROM {$wpdb->pmpro_memberships_users}
    				WHERE user_id = %d
    				  AND membership_id = %d
    				  AND status = 'active'
    				ORDER BY id DESC
    				LIMIT 1",
    						$user_id,
    						$membership->id
    		);
    
    		$row = $wpdb->get_row($sqlQuery);
    	
    		if( !empty($row) ){
    			$old_startdate = $row->startdate;
    			$old_enddate = $row->enddate;
    		
    			if ( ! empty( $old_startdate ) ) {
    				$custom_level['startdate'] = "'" . $old_startdate . "'";
    			}
    			
    			if ( ! empty( $old_enddate ) ) {
    			
    				$pmpro_level = pmpro_getLevel( $membership_id );
    				
    				$custom_level['enddate'] = date( "Y-m-d H:i:00", strtotime( "+ " . $pmpro_level->expiration_number . " " . $pmpro_level->expiration_period, strtotime($old_enddate) ) );
    			}
    		}
    	}
    
    	return $custom_level;	
    }
    add_filter( 'pmprowoo_checkout_level', 'pmprowoo_checkout_level_custom', 10 );

    This custom code I made are for memberships bought through Woocommerce only, and it’s made specifically for my websites conditions.

    Essentially the code allows my multiple premium plans to accumulate with each other, so if a client purchases a 1 month premium plan and after opts for the 2 month discounted premium plan, the client can buy the 2 month and have it accumulate with the 1 month thus having 3 months total of the premium plan role. The “is_premium_member” function just checks if the user already has a plan which is considered premium so it can accumulate its remaining time with the new premium plan purchase.

    Thank you.

    Plugin Author Andrew Lima

    (@andrewza)

    Paid Memberships Pro does not alter subscriptions when sold through WooCommerce. You would need to ask WooCommerce support about their WooCommerce Subscriptions functionality (which allows WooCommerce to have automatic recurring payments).

    If you are selling products that are linked to a membership with an expiration date, if the customer purchases the same membership linked product (not a subscription product) their expiration date will also be extended as mentioned above, as long as it’s the same membership level ID.

    I was referring to checkouts placed through Paid Memberships Pro checkout page (“default” checkouts).

    • This reply was modified 1 year, 10 months ago by Andrew Lima.
    • This reply was modified 1 year, 10 months ago by Andrew Lima.
    Plugin Author Andrew Lima

    (@andrewza)

    Because there have not been any recent updates to this topic, we will be changing the status to resolved. If you have any new questions or if your issue persists, please feel free to create a new topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Accumulate membership times’ is closed to new replies.