Cancel payment of subscription but not subscription

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WC Subscriptions Cancel payment of subscription but not subscription

Viewing 1 reply thread
  • Author
    Posts
    • #101953
      defaperacm
      Participant

      Hi.
      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.

    • #101955
      defaperacm
      Participant

      first 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

Viewing 1 reply thread
  • You must be logged in to reply to this topic.