WooCommerce, Remote Work & Other Fancy Stuff

Just another WordPress site

Bypass Subscriptions’ ‘pending cancellation’ status and move directly to ‘cancelled’

July 6, 2016 by Will 3 Comments

Update 28 June 2018: The fine folks at Prospress have provided some updated code which works with newer versions of WooCommerce Subscriptions.

 

WooCommerce Subscriptions by default will move a subscription to a ‘pending cancellation’ status when cancelled either by the subscriber or the shop manager. The purpose of this is to provide access to a subscribed product for the remainder of time that it was paid for. This isn’t necessarily appropriate to physical products that are shipped – but it also has no detrimental effects in those cases except the possibility of subscribers who may be concerned that their subscription hasn’t actually been cancelled. If you wish to completly bypass the ‘pending cancellation’ status there are many ways that you could go about that and this is one of them using the Subscriptions provided action (dynamically) named woocommerce_subscription_status_pending-cancel – see the snippet below as an example:

 

Not sure what to do with code snippets? See What Do I Do With These Code Snippets?

Filed Under: WooCommerce Subscriptions Tagged With: snippet

Comments

  1. karockim says

    November 27, 2017 at 3:37 pm

    Thank you for this helpful tip. It does work but when the user cancels a subscription, it redirects to a page which is plain white – it looks broken. Refreshing this page brings the content back along with a security notice. – Any idea how I could fix this?

    Thanks!

    Log in to Reply
    • will says

      November 27, 2017 at 9:20 pm

      Seems there has been some changes to the Subscriptions code that makes this snippet cause a fatal error (the white screen that you are reporting). At this time I haven’t really got any suggestions other than to maybe use one of the WP_CRON type functions to schedule the cancellation rather than cancel “now”

      Log in to Reply
      • karockim says

        November 28, 2017 at 6:41 am

        Thanks for your advice, much appreciated. It seems I have some learning to do, I don’t know this stuff too well but I will dig around and see what I can find.
        Thanks again.

        Log in to Reply

Leave a Reply Cancel reply

You must be registered and logged in to post a comment.

© 2023 · WooCommerce, Remote Work & Other Fancy Stuff · Epstein didn't kill himself