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

New Settings UI: Disable settings in send-only countries (4027) #2937

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

hmouhtar
Copy link
Collaborator

Description

This PR updates the settings screen to hide all settings if the store's current country is classified as a send-only country. Instead, a message explaining this limitation will be displayed.

Steps to Test

  1. Enable the new settings UI
  2. Set the WooCommerce store country to one that is within the send-only list. This list can be found in PCP-3970.
  3. Verify that no settings appear on the PayPal settings screen. Instead, a message explaining this limitation should be displayed.

Screenshots

WooCommerce-settings-‹-WooCommerce-PayPal-Payments-—-WordPress-12-19-2024_02_41_PM

@hmouhtar
Copy link
Collaborator Author

@stracker-phil I wasn’t sure if there is a specific style we need to use for notices, so I haven’t added any styling for the notice yet, just plain text.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should translate this message via __() or inject the string from server-side using wp_localize_script()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @stracker-phil, I added localization to the message in my latest commit 👍🏻

Copy link
Collaborator

@stracker-phil stracker-phil left a comment

Choose a reason for hiding this comment

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

Localization is missing 😉

@hmouhtar hmouhtar force-pushed the PCP-4027-send-only-settings branch from f92c868 to 58863ff Compare December 26, 2024 12:39
@hmouhtar hmouhtar force-pushed the PCP-4027-send-only-settings branch from 58863ff to 9278edf Compare December 26, 2024 13:03
@@ -68,8 +69,9 @@ static function () use ( $c ) {
$current_page_id = $c->get( 'wcgateway.current-ppcp-settings-page-id' );
$is_wc_settings_page = $c->get( 'wcgateway.is-wc-settings-page' );
$messaging_locations = $c->get( 'paylater-configurator.messaging-locations' );
$onboarding_state = $c->get( 'onboarding.state' );
Copy link
Collaborator

Choose a reason for hiding this comment

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

This uses the legacy onboarding status.

To check if the onboarding in the new UI is completed, you can use this logic:

$onboarding_profile = $c->get( 'settings.data.onboarding' );
$onboarding_profile->get_completed(); // true = onboarding is done, false = still in the onboarding wizard

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @stracker-phil, I've switched to the new onboarding profile class on my latest commit 👍🏻

# Conflicts:
#	modules/ppcp-settings/src/Data/CommonSettings.php
#	modules/ppcp-settings/src/Endpoint/CommonRestEndpoint.php
Before this change, the settings screen was briefly visible, before the merchant details were loaded from the REST endpoint
@stracker-phil stracker-phil merged commit da15f49 into trunk Jan 10, 2025
6 checks passed
@stracker-phil stracker-phil deleted the PCP-4027-send-only-settings branch January 10, 2025 20:12
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.

2 participants