Skip to content

Add Subscription Product Helpers/Abstractions - #854

Draft
agibson-godaddy wants to merge 3 commits into
release/6.3.0from
mwc-20234/subs-v9-helpers
Draft

Add Subscription Product Helpers/Abstractions#854
agibson-godaddy wants to merge 3 commits into
release/6.3.0from
mwc-20234/subs-v9-helpers

Conversation

@agibson-godaddy

@agibson-godaddy agibson-godaddy commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new SubscriptionProductHelper to the framework that centralizes subscription-product detection ("does this product have a subscription?") and detail lookups (period, length, trial, sign-up fee, expiration date), so plugins get correct answers whether a store is running legacy WooCommerce Subscriptions product types or WC Subscriptions 9.0+'s bundled "subscription scheme" mechanism.

Story: MWC-20234

Release: #853

Details

WC Subscriptions 9.0 merged "All Products for Subscriptions" (APFS) into core, adding a second way to sell a subscription: any Simple/Variable/etc. product can carry one or more subscription "schemes" without changing its product type. The existing WC_Subscriptions_Product::is_subscription() (and its sibling getters) only ever check the legacy product-type path, so a scheme-based product silently reports as "not a subscription" wherever that method is used on its own — this is the root cause behind MWC-20228 in WooCommerce Memberships.

Rather than fixing this as a one-off in Memberships, this PR moves the generic detection/read logic into the framework so any plugin built on it benefits:

  • Detection and lookups work correctly across both mechanisms out of the box.
  • Compatibility is gated by class/method presence rather than a Subscriptions version number, so it stays correct whether a store runs WC Subscriptions 9+ (schemes bundled) or an older WC Subscriptions with the standalone APFS plugin installed alongside it.
  • Consuming plugins (starting with Memberships via MWC-20228) can drop their own duplicate detection code and call the shared helper instead.

Includes unit test coverage for both mechanisms and the scheme fallback behavior (active → default → base scheme).

QA

TODO - test with memberships

@agibson-godaddy agibson-godaddy self-assigned this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant