Skip to content

feat(access-control): human-readable group subscription names#4667

Open
dkoo wants to merge 12 commits intotrunkfrom
feat/group-subscription-names
Open

feat(access-control): human-readable group subscription names#4667
dkoo wants to merge 12 commits intotrunkfrom
feat/group-subscription-names

Conversation

@dkoo
Copy link
Copy Markdown
Contributor

@dkoo dkoo commented Apr 15, 2026

Summary

Adds an editable field to set human-readable names for Group subscriptions (which defaults to <subscription owner>'s Group), and adds admin UX enhancements for the WooCommerce > Subscriptions list view:

Screenshot 2026-04-15 at 4 38 47 PM Screenshot 2026-04-15 at 4 37 19 PM
  • Group name in Subscription column: Group-enabled subscriptions show <group name> (<x> of <y> members) instead of the standard #<id> for <name> format, with y showing the member limit or "unlimited" if no limit is set.
  • Group subscription filter dropdown: A new dropdown filter alongside the existing product/customer/payment method filters with options for "Group subscriptions" and "Non-group subscriptions". Captures subscriptions with group enabled directly and those inheriting group status from their product. Supports both HPOS and legacy CPT modes.
  • Group name in search: The group name meta is now searchable from the subscription search box, covering the HPOS orders table, the WCS data store search, and standard WP_Query searches.
  • Unit tests: 4 new tests covering the group name setting (default name, custom override, update-and-read-back, empty fallback).

Closes NPPD-1455.

Test plan

Prerequisites

  • A Newspack site with WooCommerce Subscriptions active and define( 'NEWSPACK_CONTENT_GATES', true ); set in wp-config.php
  • At least one subscription product with "Group subscription" enabled
  • At least one active subscription with a custom group name set and members added
  • At least one regular (non-group) subscription

Editable group names w/ default

  • Create or edit a group subscription
  • Verify a new "Group name" field in the Group Subscriptions meta box, only when Group features are enabled
  • Verify default value: <subscription owner>'s Group
  • Verify default value for a subscription without any owner: Unnamed Group
  • Verify you can edit to a custom name and save, and the edited name persists

Subscription column

  • Navigate to WooCommerce > Subscriptions
  • Verify group-enabled subscriptions show the group name and member count (e.g. "Acme Newsroom (2 of 10 members)")
  • Verify subscriptions with no member limit show "unlimited" (e.g. "Test Group (0 of unlimited members)")
  • Verify non-group subscriptions still show the standard format (#ID for Name)
  • Verify the group name links to the subscription edit page

Group filter

  • Verify a "Group subscriptions" / "Non-group subscriptions" dropdown appears in the filter bar
  • Select "Group subscriptions" and verify only group-enabled subscriptions appear (including those inheriting group status from their product)
  • Select "Non-group subscriptions" and verify group subscriptions are excluded
  • Verify the filter works in combination with other filters (product, customer, etc.)
  • Reset to "All subscriptions" and verify all subscriptions appear again

Search

  • Search for a group subscription by its custom group name
  • Verify the subscription appears in search results
  • Search for a term that does not match any group name and verify it does not return false positives

Unit tests

  • Run n test-php --filter Test_Group_Subscriptions and verify all 49 tests pass

🤖 Generated with Claude Code

dkoo and others added 10 commits April 15, 2026 13:24
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n list column

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ist view

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s with members

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n filter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dkoo dkoo changed the title Feat/group subscription names feat(access-control): human-readable group subscription names Apr 15, 2026
@dkoo dkoo self-assigned this Apr 15, 2026
@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Apr 15, 2026
@dkoo dkoo marked this pull request as ready for review April 15, 2026 22:41
@dkoo dkoo requested a review from a team as a code owner April 15, 2026 22:41
Copilot AI review requested due to automatic review settings April 15, 2026 22:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for a human-readable “Group subscription name” on WooCommerce Subscriptions, and enhances the subscriptions admin list to display/filter/search using that group context.

Changes:

  • Adds a name setting to group subscription settings, including admin edit UI and save handling.
  • Customizes the Subscriptions list “Subscription” column for group subscriptions and adds a group/non-group filter.
  • Extends subscription search to include the group name meta key, and adds unit tests for name behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
includes/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-settings.php Adds group name setting, list-table display/filter/search hooks, and query helpers for group subscriptions.
tests/unit-tests/content-gate/group-subscriptions.php Adds unit tests covering default/custom/updated/empty-fallback group name behavior.
tests/mocks/wc-mocks.php Extends the WC_Subscription test mock with get_formatted_billing_full_name() used by the new default-name logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit-tests/content-gate/group-subscriptions.php
Comment thread tests/unit-tests/content-gate/group-subscriptions.php
dkoo and others added 2 commits April 15, 2026 17:03
…n admin

- Fix search WHERE clause regex to handle nested parentheses
- Scope order items query to shop_subscription type only
- Cache group subscription IDs in a 5-minute transient
- Invalidate cache on subscription and product setting changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants