Wcs upgrade compatibility

From Lonsdale201/wp-agent-skills · View interactive version

Wcs upgrade compatibility is an AI agent skill from the GitHub repository Lonsdale201/wp-agent-skills. Audits WooCommerce Subscriptions integrations across release changes, with a verified 9.2.0 baseline. Covers deprecated settings APIs, REST field contracts, per-product gifting migration, item-removal ownership and nonce changes, APFS script loading and legacy plan identity, switching, renewal disco

How to use this skill

Skill file

Subscriptions upgrade compatibility

Ground changes in the installed release source and targeted runtime evidence. Use the changelog to identify work, then distinguish removed APIs, deprecated compatibility shims, changed defaults, security boundaries and bug fixes. Do not mechanically delete every deprecated name: migration notes must still identify what to replace.

Establish the comparison

Record WCS, WooCommerce, WordPress and PHP versions; authoritative order storage and synchronization; classic/Blocks checkout; gateways; and whether products use legacy subscription types or the subscription plans integrated since WCS 9.0. Read the release's full changelog, including intervening releases when upgrading from an older baseline.

Inventory the integration's hooks, settings reads/writes, template overrides, checkout/order-pay paths, plan IDs, order metadata and background actions. Separate public extension hooks from Internal classes. An indexed signature can lag a release: resolve disagreements against the exact installed source and record the evidence, rather than treating a missing lookup as removal.

Replace deprecated settings integration

| Deprecated surface | 9.2 behavior | Migration |

|---|---|---|

| WC_Subscriptions_Admin::add_subscription_settings_tab() | Still adds a tab but emits a notice. Core now registers a WC_Settings_Page through woocommerce_get_settings_pages. | Remove companion code that registers WCS's own tab. Keep extension fields on established settings filters. |

| WC_REST_Subscriptions_Settings | Legacy mirror remains functional; autoloading the class itself emits deprecation. | Stop constructing or autoload-probing it. Use the existing /wc/v3/settings/subscriptions group. |

| woocommerce_subscriptions_max_customer_suspension_range | Deprecated callback still runs; its returned list is ignored. | Remove option-list logic. If overriding the effective limit, use pre_option_woocommerce_subscriptions_max_customer_suspensions with the canonical value contract. |

| WCSG_Admin::get_gifting_option_text() / get_gifting_global_override_text() | Describe a removed storewide default. | Remove consumers of those descriptions; use per-product gifting controls. |

The replacement Settings_Page implementation is under Automattic\WooCommerce_Subscriptions\Internal; its existence is not a stable class API to instantiate. Its output callback runs at priority 1, before normal priority-10 callbacks. Audit code that tries to output before/after the built-in settings.

For upgrades crossing 9.1, also replace calls to deprecated WC_Subscriptions_Cart::get_formatted_product_subtotal() and get_due_today_subtotal(). Due-today presentation now uses woocommerce_cart_item_subtotal; direct WC()->cart->get_product_subtotal() receives standard Woo output.

Preserve settings values and migrations

Read references/release-9.2.md for the full release impact map, transitional gifting behavior and regression scenarios.

Keep permissions and operation tokens aligned

wcs_can_items_be_removed( $subscription, $user_id = 0 ) now passes the resolved user as the third argument to its filter, then checks edit_shop_subscription_line_items. A true filter return cannot authorize an otherwise unauthorized customer. Pass the owner explicitly in noninteractive contexts; actor 0 falls back to the current user. Do not add a global capability override to restore an obsolete UI control.

Test a customer-owned subscription with its owner, another customer and no current user. Treat ownerless/guest subscriptions separately: the source's capability mapping can compare owner ID 0 with user ID 0, so do not generalize the owned-subscription test into an unconditional anonymous-denial guarantee.

Removal and resubscribe URLs now use different operation-specific nonce actions. Use WCS URL builders; do not reuse tokens or mint ID-only nonces. Previously generated URLs fail verification. Reopen resubscribe links from My Account; an old removal Undo URL cannot simply be reissued. Keep capability checks in addition to nonces.

Audit plans, switching and money

Verify the integration

The WP-CLI smoke example creates synthetic fixtures for WooCommerce 11.1.1 and WCS 9.2.0. Use a disposable installation with blocked network egress, intercepted mail and disabled cron/async queue runners. Set WP_ENVIRONMENT_TYPE=local and WOO_SKILLS_SMOKE_ALLOW_WRITES=true, activate the example, then run wp woo-skills-smoke run --confirm-disposable. Discard the environment afterward.

Test posts-based and HPOS storage separately. Add browser, gateway, tax and migration tests for the integration's actual scope; the CLI example does not cover these workflows. Keep run reports outside the skill collection.

Cross-references

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.