Automattic / wc-calypso-bridge

20 stars 4 forks source link

Disable launch your store on trial sites #1507

Closed chihsuan closed 1 month ago

chihsuan commented 2 months ago

Changes proposed in this Pull Request:

Closes https://github.com/Automattic/wc-calypso-bridge/issues/1504.

Apply all of the below for trial plans (both ecommerce and business trial plans)

@ilyasfoo I'm using wc_calypso_bridge_is_ecommerce_trial_plan() to check if the store is on a trial plan. I'm not sure if this is sufficient. Please let me know if there is a better way to check if the store is on any trial plan. πŸ™

How to test the changes in this Pull Request:

  1. Setting up a free eCommerce trial site for development peapX7-1D4-p2
  2. Use master branch
  3. Enable LYS feature flag (via beta tester or you can remove these lines).
  4. Go to /wp-admin/admin.php?page=wc-settings&tab=site-visibility
  5. Enable Coming Soon mode
  6. Checkout this branch
  7. Go to /wp-admin/admin.php?page=wc-settings&tab=site-visibility and confirm you're redirected to /wp-admin/admin.php?page=wc-settings
  8. Confirm Site visibility settings tabs are hidden
  9. Go to WooCommerce > Home and confirm Launch your store task is hidden
  10. Go to the frontend and confirm the coming soon banner is not shown
  11. Go to the frontend in incognito mode and confirm the LYS coming soon page is not shown
  12. Confirm site visibility badge is not shown

Other information:

FOR PR REVIEWER ONLY:

github-actions[bot] commented 2 months ago

Size Change: 0 B

Total Size: 201 kB

ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `./build/53.js` | 1.08 kB | | `./build/index.css` | 878 B | | `./build/index.js` | 126 kB | | `./build/marketing.js` | 58.3 kB | | `./build/payment-gateway-suggestions.css` | 1.24 kB | | `./build/payment-gateway-suggestions.js` | 6.57 kB | | `./build/plugins.js` | 3.93 kB | | `./build/style-index.css` | 2.15 kB | | `./build/style-marketing.css` | 800 B |

compressed-size-action

chihsuan commented 1 month ago

That's a good question! I tested in my business plan site and indeed this did not return true. I wrote a function that detects it, but it's only lightly tested with my business plan site:

Thanks @ilyasfoo, I'll try that out and look into it more. πŸ™Œ

chihsuan commented 1 month ago

@ilyasfoo πŸ‘‹ I added a helper function wc_calypso_bridge_is_trial_plan in 5f5352d2b840b894e8291f474e906c749f8376c4. It checks if the plan is a trial plan by reusing is_ecommerce_trial_plan and checking the plan slug against a list of trial plans wp-bundle-hosting-trial, wp-bundle-migration-trial (See fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Snqzva%2Qcyhtvaf%2Sjcpbz%2Qovyyvat%2Scebqhpgf%2Sohfvarff%2Qgevny%2Qohaqyr.cuc%3Se%3Q29r2n341%23274%2Q277-og).

I tested the code on a business plan site, and it worked as expected. Could you please take a look at the change and possibly review it? Thanks! πŸ™

adrianduffell commented 1 month ago

We should also revert the coming soon should_show_a8c_coming_soon_page to use WPCOM's coming soon when it's a trial site.

@ilyasfoo @chihsuan is the concern here that free trial users could customize the Woo template too much? I suppose they could add a checkout block or something πŸ€”

I'm happy with this for now, but I think it would be worth returning to when we create a newsletter signup template. I think it would be good to allow free trial users to have access to that. Instead, perhaps in Core we need to place direct protections on the checkout when coming soon mode is active.

ilyasfoo commented 1 month ago

@ilyasfoo @chihsuan is the concern here that free trial users could customize the Woo template too much? I suppose they could add a checkout block or something πŸ€”

@adrianduffell Good point, my original concern was that it was showing the live site since we were in live mode and WPCOM coming soon was bypassed. I think free trial users being able to add a checkout block is also a valid concern.

I'm happy with this for now, but I think it would be worth returning to when we create a newsletter signup template. I think it would be good to allow free trial users to have access to that. Instead, perhaps in Core we need to place direct protections on the checkout when coming soon mode is active.

I agree, let's revisit this in the future πŸ‘

adrianduffell commented 1 month ago

my original concern was that it was showing the live site since we were in live mode and WPCOM coming soon was bypassed

@ilyasfoo With https://github.com/Automattic/wc-calypso-bridge/pull/1506, would the woo coming soon mode now always be on for free trial sites? (by inheriting the WPCOM value)

ilyasfoo commented 1 month ago

With https://github.com/Automattic/wc-calypso-bridge/pull/1506, would the woo coming soon mode now always be on for free trial sites? (by inheriting the WPCOM value)

@adrianduffell Yes, the state will be coming soon since the site is "Unlaunched"

chihsuan commented 1 month ago

Thanks for working on this, @chihsuan! Apologies for missing this in the issue description, but we should also hide the admin bar badge πŸ™

image

We should also revert the coming soon should_show_a8c_coming_soon_page to use WPCOM's coming soon when it's a trial site.

Hey @ilyasfoo, I've pushed the changes to hide the admin bar badge and to use WPCOM's coming soon page for trial sites. Could you take a look again? Thanks. πŸ™

You will need to use WooCommerce trunk or 9.3 beta to test the admin badge.

wp plugin install https://github.com/woocommerce/woocommerce/releases/download/nightly/woocommerce-trunk-nightly.zip --activate