Skip to content

Instantly share code, notes, and snippets.

@woogist
Created February 2, 2026 08:24
Show Gist options
  • Select an option

  • Save woogist/5e4f0746b36cd0bc57b398e3868eca24 to your computer and use it in GitHub Desktop.

Select an option

Save woogist/5e4f0746b36cd0bc57b398e3868eca24 to your computer and use it in GitHub Desktop.
[WooCommerce Memberships] Add custom user membership statuses
<?php // only copy this line if needed
/**
* Add custom user membership statuses
*
* @param array $statuses the array of membership statuses
* @return array $statuses the updated status array
*/
function sv_wc_memberships_add_membership_statuses( $statuses ) {
$new_statuses = array(
'wcm-refunded' => array(
'label' => 'Refunded',
'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>' ),
),
'wcm-some-status' => array(
'label' => 'Another Status',
'label_count' => _n_noop( 'SomeStatus <span class="count">(%s)</span>', 'SomeStatus <span class="count">(%s)</span>' ),
),
);
$statuses = array_merge( $statuses, $new_statuses );
return $statuses;
}
add_filter( 'wc_memberships_user_membership_statuses', 'sv_wc_memberships_add_membership_statuses' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment