Tips and Tricks HQ Support Portal › Forums › WP eMember › Allow user to purchase subscription upgrade but not change account expiration
- This topic has 4 replies, 2 voices, and was last updated 6 years, 2 months ago by admin.
-
AuthorPosts
-
September 19, 2018 at 2:38 am #15103nullsignatureMember
Note: I have eMember and eStore.
I have two subscriptions plans-
Plan 1, $25, 6 months
Plan 2, $45, 6 months
If a user is on Plan 1 and 3 months in decides to upgrade to Plan 2, I’d like them to be able to buy a upgrade priced at $20 that will move them to Plan 2 but NOT reset or extend their subscription expiration. So if they upgraded 3 months in there would still only be 3 months left on their subscription.
What I’m thinking is of having a product in the eStore priced at $20 that doesn’t really do anything, and upon purchasing that product the shortcode [wp_eMember_upgrade_membership_level_to level=”#”] (or a similar PHP function/hook if available) would execute. From what I’ve read, that shortcode does not extend expiration, correct?
What I’m having trouble determining is how to get that shortcode to execute upon purchase of this product. Or is there an easier way to do this that I’m overlooking?
September 19, 2018 at 5:50 am #78568adminKeymasterWhat happens if they want to upgrade after 2 months or 4 months?
September 19, 2018 at 12:08 pm #78569nullsignatureMemberI want their subscription to expire from the original date of purchase, regardless of when they upgrade. It could be a week after they purchase or a week before they expire.
Plan 2 is the same as Plan 1, except it includes links to some digital downloads. So basically, by upgrading from Plan 1 to Plan 2, all they’d be doing is buying these downloads- not really buying an upgraded subscription with different access levels. I want to keep the digital download tied to membership (and not standalone products) due to how the site is structured and accessed.
Am I correct in that the shortcode [wp_eMember_upgrade_membership_level_to level=”#”] does not extend the expiration?
I’m thinking of using a hook that generates a random code for a user when they purchase that upgrade, then they enter that code in order to execute the upgrade shortcode. I just need a way to get the random code to the user. Does the post payment action add-on support variables in emails?
September 19, 2018 at 9:49 pm #78570nullsignatureMemberOr I could just have the hook execute the upgrade. I really overthought that one.
Is there a hook for when a product is purchased, and then a way to get the product ID of what was purchased?
Here’s some pseudo code to demonstrate what I’m asking:
add_action(UpgradeMember, wp_estore_item_purchased)
function UpgradeMember($member, $product_id){
if($product_id == 3){
$member[membership_level] = “Plan 2”;
}
}
September 20, 2018 at 4:54 am #78571adminKeymasterYes, there are a few action hooks in eStore that gets triggered after every transaction. Once of those should be usable. I have sent you an email. Please reply to it.
-
AuthorPosts
- You must be logged in to reply to this topic.