Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Subscriptions › Cancel payment of subscription but not subscription
Tagged: cancel, payment, subscription, vendor
- This topic has 1 reply, 1 voice, and was last updated 5 years, 1 month ago by
defaperacm.
- AuthorPosts
- January 14, 2020 at 1:08 am #101953
defaperacm
ParticipantHi.
I have a “premium” subscription wich have to be payed monthly. the case is if one user doasn’t pays the subscription, the plugin assigns to it the “disabled vendor” profile.Olso une user told to me the other day that when trying to cancel the susbcription payment for the next month. his subscription was cancelled.
how can i fix it?
ani shortcodes or hooks will be appreciated. - January 14, 2020 at 1:56 am #101955
defaperacm
Participantfirst issue solved with this code (just add tho functions.php in custom theme):
$cancelled = false; function on_cancelled_subscription($user_id) { if (!$cancelled) { update_user_meta( $user_id, '_disable_vendor', false ); $user = get_user_by( 'id', $user_id ); $user->set_role( 'wcfm_vendor' ); } $cancelled = true; } add_action('wcfm_membership_data_reset', 'on_cancelled_subscription');
$cancelled flag is used because the action ‘on_cancelled_subscription’ may be called more tha one time, so it prevents from spamming the database
this code was made by ¿reverse-engineered? the file class-wcfmvm.php
- AuthorPosts
- You must be logged in to reply to this topic.