Skip to content

Conversation

@miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Sep 16, 2025

All Submissions:

Changes proposed in this Pull Request:

Introduces a new URL that triggers subscription purchase or upgrade. To enable the URL, the site must have an assigned primary subscription product, which should be configured in the "Audience > Subscriptions" admin page.

Products eligible for selection are "Grouped Products" or "Variable Subscriptions". In the context of grouped products, only linked subscriptions or variable subscriptions will be used.

image

Purchasing:

image

Upgrading:

image

This is currently a hidden feature, but the query argument can also be modified to determine the modal title and submit button:

https://example.com/?upgrade-subscription=Upgrade%20your%20membership

The custom label will be applied for purchases and subscription switching:

image

How to test the changes in this Pull Request:

  1. As an admin, navigate to Audience -> Subscriptions
  2. Confirm the page renders the new "Primary Subscription Tier Product" card
  3. Open the select options and confirm all Grouped Products and Variable Subscriptions are listed (except donation products)
  4. Select a product and refresh the page
  5. Confirm the selection persists
  6. Copy the URL from the notice and paste it into a new session
  7. Confirm the modal renders prompting a purchase
  8. Complete the purchase
  9. In the same session, visit the URL again
  10. Confirm the modal renders prompting an upgrade
  11. Complete the upgrade

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

miguelpeixe and others added 30 commits August 20, 2025 12:54
@miguelpeixe
Copy link
Member Author

Looks like if there's already a query param in the current page, the URL constructed for the checkout modal will contain two ? characters and be invalid. Changing these lines to the following fixed it for me:

Thank you for catching that! Fixed in 965cfaf

It looks like the URL was being constructed with item_id=0 because you can't access a WC_Order_Item_Product's id directly by array key—you need to use its $item->get_id() method. See suggestion below.

I have no idea how it was working before, but I also needed this change while testing now.

Should the tiers modal hide Campaigns prompts and other modals/overlays when it's active, like the auth and checkout modals?

Good call, added in e46af19. I opted for disabling all prompts because this is a campaign on its own. I don't think the reader should hit an overlay campaign after closing this modal. Wdyt?

Also in the wizard UI, it might be helpful for publishers to include some description copy here describing what the Primary Subscription Tier Product's purpose is. Something like "Select a grouped or variable subscription product to allow readers to change their active subscriptions amongst all of its child products and variations."

Changed it to "Select a grouped or variable subscription product to allow readers to change their active subscriptions amongst all of its linked products and variations." so it reflects the grouped product configuration terminology.

A nice-to-have: Once you've selected a primary product it would be nice to have a link to that product's edit page in WP admin.

Nice! Added in 6ae77b2

image

Very nitpicky, but I wanted the "Share the following URL to trigger the subscription upgrade: " message to show the URL as a link so I could command-click and copy it.

Good call! Added in 72a427b

@miguelpeixe miguelpeixe requested a review from dkoo October 3, 2025 18:30
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

I opted for disabling all prompts because this is a campaign on its own. I don't think the reader should hit an overlay campaign after closing this modal. Wdyt?

I'm fine with this approach, as long as it's okay that any inline prompts will also be hidden. Do you anticipate most publishers will share this link with the param appended the homepage, or something else like My Account?

Not sure if you saw my earlier comment, but since it's non-blocking I'll approve:

In the wizard UI for setting a Primary Subscription Tier Product, once you've set a primary product there's no way to unset it without selecting a different product. Should we include a "clear" button in case that's ever needed?

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator labels Oct 3, 2025
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

@miguelpeixe I missed something before approving—with the latest changes I see the modal checkout opening in a new browser tab instead of inside the modal. Is something off with the appending to searchParams?

EDIT: looks like if there's not already a modal checkout feature on the page, window.newspackOpenModalCheckout is undefined. This was probably obscured before because one of my Campaigns prompts had a Donate block (and therefore was rendering a checkout modal).

@github-actions github-actions bot added [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator and removed [Status] Approved The pull request has been reviewed and is ready to merge labels Oct 3, 2025
@miguelpeixe
Copy link
Member Author

looks like if there's not already a modal checkout feature on the page, window.newspackOpenModalCheckout is undefined. This was probably obscured before because one of my Campaigns prompts had a Donate block (and therefore was rendering a checkout modal).

Whoops! I never caught that because my homepage has Checkout Button blocks in it. Fixed in 0e99b7a

In the wizard UI for setting a Primary Subscription Tier Product, once you've set a primary product there's no way to unset it without selecting a different product. Should we include a "clear" button in case that's ever needed?

Sorry, I missed this one. Good call, added in 13359a4

image

@miguelpeixe miguelpeixe requested a review from dkoo October 3, 2025 20:07
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

Looking good now, thanks!

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator labels Oct 3, 2025
@miguelpeixe
Copy link
Member Author

Thank you for the thorough review and great suggestions! 🙇

@miguelpeixe miguelpeixe merged commit 1137770 into trunk Oct 3, 2025
9 checks passed
@miguelpeixe miguelpeixe deleted the feat/primary-subscription-product branch October 3, 2025 20:39
@github-actions
Copy link

github-actions bot commented Oct 3, 2025

Hey @miguelpeixe, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

matticbot pushed a commit that referenced this pull request Oct 17, 2025
# [6.22.0-alpha.1](v6.21.2...v6.22.0-alpha.1) (2025-10-17)

### Bug Fixes

* **collections:** remove collection-related taxonomies from quick edit ([#4222](#4222)) ([e327230](e327230))
* **content-gate-countdown-block:** update block design ([fda287c](fda287c))
* ga4 events for gate interactions and tiered modal ([#4209](#4209)) ([162f34a](162f34a))
* keep prevent one and two col Collections block grid from being increased on smaller screens ([#4224](#4224)) ([482eef6](482eef6))
* **lite-site:** allow line breaks ([#4221](#4221)) ([ead3283](ead3283))
* **metering:** get current user metered views ([#4227](#4227)) ([ebc32b7](ebc32b7))
* **my-account:** new payment method style tweaks ([#4220](#4220)) ([88a638c](88a638c))
* **subscription-switch:** unhook direction text from checkout ([#4229](#4229)) ([69915ef](69915ef))

### Features

* **audience:** primary subscription product ([#4191](#4191)) ([1137770](1137770))
* **collections:** add archive link in settings page ([#4203](#4203)) ([8aad8ca](8aad8ca))
* **collections:** add css classes to meta elements ([#4208](#4208)) ([2a13af6](2a13af6))
* **collections:** implement design feedback for archive link ([#4219](#4219)) ([da35672](da35672))
* **InDesign:** inline image caption, horizontal rule, headings and blockquotes ([#4201](#4201)) ([c39b9f9](c39b9f9))
* **my-account:** add delete payment method modal confirmation ([#4216](#4216)) ([3220af2](3220af2))
* **my-account:** addresses ([#4206](#4206)) ([d57b1c9](d57b1c9))
* **newspack-icons:** add ai and ai-text to npm package ([#4235](#4235)) ([06789a9](06789a9))
* **newspack-icons:** add typescript support; add new icons ([#4088](#4088)) ([bb2cb82](bb2cb82))
* validate donation products ([#4163](#4163)) ([de24ff4](de24ff4))
* **woocommerce:** enable block emails ([#4218](#4218)) ([0643158](0643158))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.22.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Oct 30, 2025
# [6.22.0](v6.21.4...v6.22.0) (2025-10-30)

### Bug Fixes

* add feature flag to countdown block and email enhancements ([#4262](#4262)) ([b8691d8](b8691d8))
* **collections:** remove collection-related taxonomies from quick edit ([#4222](#4222)) ([e327230](e327230))
* **content-gate-countdown-block:** update block design ([fda287c](fda287c))
* ga4 events for gate interactions and tiered modal ([#4209](#4209)) ([162f34a](162f34a))
* keep prevent one and two col Collections block grid from being increased on smaller screens ([#4224](#4224)) ([482eef6](482eef6))
* **lite-site:** allow line breaks ([#4221](#4221)) ([ead3283](ead3283))
* **metering:** get current user metered views ([#4227](#4227)) ([ebc32b7](ebc32b7))
* **my-account:** new payment method style tweaks ([#4220](#4220)) ([88a638c](88a638c))
* **subscription-switch:** unhook direction text from checkout ([#4229](#4229)) ([69915ef](69915ef))
* **subscriptions-tiers:** standardize product input name ([#4261](#4261)) ([4194267](4194267))
* tweak configuration labels for the primary subscription product ([#4260](#4260)) ([ab5a5c7](ab5a5c7))
* **upgrade-subscription-link:** remove query arg onload ([#4263](#4263)) ([87fe3d4](87fe3d4))

### Features

* **audience:** primary subscription product ([#4191](#4191)) ([1137770](1137770))
* **collections:** add archive link in settings page ([#4203](#4203)) ([8aad8ca](8aad8ca))
* **collections:** add css classes to meta elements ([#4208](#4208)) ([2a13af6](2a13af6))
* **collections:** implement design feedback for archive link ([#4219](#4219)) ([da35672](da35672))
* **InDesign:** inline image caption, horizontal rule, headings and blockquotes ([#4201](#4201)) ([c39b9f9](c39b9f9))
* **my-account:** add delete payment method modal confirmation ([#4216](#4216)) ([3220af2](3220af2))
* **my-account:** addresses ([#4206](#4206)) ([d57b1c9](d57b1c9))
* **my-account:** edit donation amount ([#4200](#4200)) ([f84d121](f84d121))
* **newspack-icons:** add ai and ai-text to npm package ([#4235](#4235)) ([06789a9](06789a9))
* **newspack-icons:** add typescript support; add new icons ([#4088](#4088)) ([bb2cb82](bb2cb82))
* validate donation products ([#4163](#4163)) ([de24ff4](de24ff4))
* **woocommerce:** enable block emails ([#4218](#4218)) ([0643158](0643158))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.22.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants