Created
February 2, 2026 08:24
-
-
Save woogist/5e4f0746b36cd0bc57b398e3868eca24 to your computer and use it in GitHub Desktop.
[WooCommerce Memberships] Add custom user membership statuses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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