Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show notice for expired and expiring subscriptions in settings and in-app extensions page #47004

Open
wants to merge 24 commits into
base: trunk
Choose a base branch
from

Conversation

manzurahammed
Copy link
Contributor

@manzurahammed manzurahammed commented Apr 28, 2024

Submission Review Guidelines:

Show notice on the WC settings page and marketplace page about expired and expiring subscriptions

Notices we want to show:

  • Expired subscriptions
  • Expiring Subscriptions expiring (Subscription expiring soon)

Changes proposed in this Pull Request:

  • Added notice in WC core settings page and extensions page

Note about notices:

  • Notice will show when the store are connected with woo commerce.com
  • Those should be dismissable
  • Once dismissed, they should not appear again for the user next time:

Messages we want to show:

  • expired subscriptions
    • single expired subscription for product X and the user has only a single subscription to X: Your subscription for [product name] expired. Renew for [price] to continue receiving updates and streamlined support.
    • single expired subscription for product X and the user has multiple subscriptions to X: One of your subscriptions for [product name] has expired. Renew for [price] to continue receiving updates and streamlined support.
    • multiple expired subscriptions: You have X Woo extension subscriptions that expired. Renew to continue receiving updates and streamlined support.
  • subscriptions expiring soon
    • single subscription for product X is about to expire and the user has only a single subscription to X: Your subscription for [product name] expires on [date]. Enable auto-renewal to continue receiving updates and streamlined support.
    • single expired subscription for product X and the user has multiple subscriptions to X: One of your subscriptions for [product name] expires on [date]. Enable auto-renewal to continue receiving updates and streamlined support.
    • multiple expired subscriptions: :You have X Woo extension subscriptions expiring soon. Enable auto-renewal to continue receiving updates and streamlined support.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Build WooCommerce on your local environment, e.g.: cd plugins/woocommerce then nvm use && pnpm run build --filter=woocommerce.
  2. Connected your store with local woocommerce.com test site.
  3. Make sure you have no expired subscriptions and no subscriptions expiring in the next 7 days
  4. Go to the WC setting page and Extension page and confirm you see no notices related to subscriptions
  5. Make sure you have 2 paid subscriptions for the same product, note their order IDs: <order_id_a>, <order_id_b>
  6. Set one of the orders as expiring soon by setting an expiry date in the next 7 days.

Screenshot 2024-04-30 at 6 47 39 PM

  1. Set one of the orders as expiring soon by setting an expiry date in the next 7 days (From same two products). To do that, run the above query

Screenshot 2024-04-30 at 7 00 53 PM

  1. Make sure that you have different products expiring soon, you should see a different message now:

Screenshot 2024-04-30 at 6 58 38 PM

  1. Set one of the subscriptions as expired

Screenshot 2024-04-30 at 1 56 20 AM

  1. Add more expired subscriptions and confirm that message changes properly
  2. Dismiss the notice and refresh the page. You shouldn't see notice about expired/expiring subscriptions.

Screenshot 2024-04-30 at 1 58 38 AM

Screenshot 2024-04-30 at 2 02 57 AM

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 28, 2024
Copy link
Contributor

github-actions bot commented Apr 28, 2024

Hi @gedex, @hesahesa, @adrianduffell, @mehamasum,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch 2 times, most recently from be8f6dc to d56a010 Compare April 29, 2024 13:32
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch from d56a010 to d5864be Compare April 29, 2024 13:33
@manzurahammed manzurahammed self-assigned this Apr 29, 2024
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch 2 times, most recently from d533b14 to 6c6a1cb Compare April 30, 2024 13:17
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch 3 times, most recently from 2394111 to 00c4a3c Compare April 30, 2024 15:05
not showing expiring subs notice if expired sub notice render
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch from 00c4a3c to a2324fe Compare April 30, 2024 15:28
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch from f56b72b to 3e9a875 Compare April 30, 2024 17:28
@manzurahammed manzurahammed marked this pull request as ready for review April 30, 2024 18:07
@manzurahammed manzurahammed force-pushed the add-woo-admin-notice-for-expire-sub branch from d39e32f to 88b5db9 Compare May 1, 2024 17:12
@mehamasum mehamasum changed the title Show notice for expired and expiring subscriptions Show notice for expired and expiring subscriptions in settings and in-app extensions page May 13, 2024
public static function woo_subscriptions_notice_dismiss_api() {
register_rest_route(
'wc-admin',
'/woo_subscription_notice_dissmiss',
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest making the endpoint path to be more general (because the endpoint is used to mark whether a notice is dismissed or not)

The notice type to be dismissed is already contained in the parameter, right?

* Register the routes for dismissal subscriptions notice.
*/
public static function woo_subscriptions_notice_dismiss_api() {
register_rest_route(
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about putting the rest route API registration in the plugins/woocommerce/src/Admin/API instead? because it seems like it is more suitable place there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I will move this endpoint to Admin/API section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed e5f740a

@KokkieH
Copy link
Contributor

KokkieH commented May 15, 2024

Just a heads up that Desire also has changes pending to the <Content/> component in #47452 to hide notices from the new Business Services tab we're adding in-app. It also changes how the <PluginInstallNotice/> is added, as adding it inside the <Products/> component was causing it to be rendered multiple times on the Search Results tab.

Copy link
Contributor

github-actions bot commented May 15, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@manzurahammed
Copy link
Contributor Author

Thanks for the heads up, @KokkieH . I've updated the component logic to ensure that notices are hidden from the new Business Services tab.

https://github.com/woocommerce/woocommerce/pull/47004/files#diff-66d84dd7feb9389b0808515aed92c9eebc6bad572bd192d6ca327bee3b6796d1R198

@gedex
Copy link
Member

gedex commented May 21, 2024

I connected to an account that have expired subscriptions but none of those expired subscriptions are used on the site.

image

Is this expected for the store without any expired products being used and still got the notice? If the connected account is a builder / agency that have multiple clients this would confuse the client.

cc @mehamasum @hesahesa

@gedex
Copy link
Member

gedex commented May 21, 2024

Despite of the issue of all connected stores get the same notice, here's my tests based on PR's instruction:

  • user connected; expired
    • has one expired sub — message: Your subscription for [product name] expired. Renew for [price] to continue receiving updates and streamlined support — ⚠️
    • has multiple subs of the same product; one is expired — message: One of your subscriptions for [product name] has expired. Renew for [price] to continue receiving updates and streamlined support — ⚠️
    • has multiple subs expired — message: You have X Woo extension subscriptions that expired. Renew to continue receiving updates and streamlined support
  • user connected; expiring
    • has one sub — message: Your subscription for [product name] expires on [date]. Enable auto-renewal to continue receiving updates and streamlined support
    • has multiple subs of the same product; one is expiring — message: One of your subscriptions for [product name] expires on [date]. Enable auto-renewal to continue receiving updates and streamlined support
    • has multiple subs expiring — message: You have X Woo extension subscriptions expiring soon. Enable auto-renewal to continue receiving updates and streamlined support

@gedex
Copy link
Member

gedex commented May 21, 2024

has one expired sub — message: Your subscription for [product name] expired. Renew for [price] to continue receiving updates and streamlined support

has multiple subs of the same product; one is expired — message: One of your subscriptions for [product name] has expired. Renew for [price] to continue receiving updates and streamlined support

Price is missing

image image

return array();
}

$subscriptions = WC_Helper::get_subscriptions();
Copy link
Contributor

Choose a reason for hiding this comment

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

note that this gets connected user's subscriptions (does not consider the site it's connected from)

return array();
}

$subscriptions = WC_Helper::get_subscriptions();
Copy link
Contributor

Choose a reason for hiding this comment

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

note that this gets connected user's subscriptions (does not consider the site it's connected from)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants