Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Last active November 12, 2021 19:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thenbrent/2b2b328b1413e563adfb to your computer and use it in GitHub Desktop.
Save thenbrent/2b2b328b1413e563adfb to your computer and use it in GitHub Desktop.
Change the name of the "Pending Cancellation" status in WooCommerce Subscriptions to be "Cancelled Payments".
<?php
/**
* Plugin Name: WooCommerce Subscriptions Change Pending Cancellation Status
* Plugin URI: https://gist.github.com/thenbrent/2b2b328b1413e563adfb
* Description: Change the name of the "Pending Cancellation" status in WooCommerce Subscriptions to be "Cancelled Payments".
* Author: Prospress Inc.
* Version: 1.0
* Author URI: http://prospress.com
*/
function eg_change_pending_cancellation_status( $subscription_statuses ) {
$subscription_statuses['wc-pending-cancel'] = _x( 'Cancelled Payments', 'Subscription status', 'woocommerce-subscriptions' );
return $subscription_statuses;
}
add_action( 'wcs_subscription_statuses', 'eg_change_pending_cancellation_status', 0 );
function eg_change_pending_cancellation_status_admin( $subscription_statuses ) {
$subscription_statuses['wc-pending-cancel'] = _nx_noop( 'Cancelled Payments <span class="count">(%s)</span>', 'Cancelled Payments <span class="count">(%s)</span>', 'post status label including post count', 'woocommerce-subscriptions' );
return $subscription_statuses;
}
add_action( 'woocommerce_subscriptions_registered_statuses', 'eg_change_pending_cancellation_status_admin', 0 );
@bvdr
Copy link

bvdr commented Nov 13, 2015

Thanks it works super ok. I had to return the object though to make it work.
return $subscription_statuses;

@Dennis-TheCoffeeCollective

bvdr - where did you put in that line?
Cause I can't get it to work. The text is changed to "pending-cancel" instead of "Cancelled Payments".

@simonlk
Copy link

simonlk commented Dec 18, 2016

@Dennis-TheCoffeeCollective where it says:

$subscription_statuses;

Change to:

return $subscription_statuses;

@thenbrent
Copy link
Author

I've just fixed up the issue with returning the statuses. :)

@oo-matty
Copy link

I realize this is ancient stuff, but is there a snippet for modifying the other subscription statuses (wc-on-hold, etc)? I haven't found any other comments or snippets that will tackle this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment