[LYS] - Make sure LYS options are available for WooPayments (#47685)

* add viz options on wcpay screens

* Add changefile(s) from automation for the following project(s): woocommerce

* cleanup

* lint

* wp_unslash lint errors

* disable

* linter

* more linting

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Paul Sealock 2024-05-22 20:16:35 +12:00 committed by GitHub
parent fb2b79f502
commit 01bfab0527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: add
Comment: Adds to previously unreleased feature

View File

@ -81,7 +81,14 @@ class LaunchYourStore {
$current_screen = get_current_screen();
$is_setting_page = $current_screen && 'woocommerce_page_wc-settings' === $current_screen->id;
if ( $is_setting_page ) {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
$is_woopayments_connect = isset( $_GET['path'] ) &&
isset( $_GET['page'] ) &&
( '/payments/connect' === sanitize_text_field( wp_unslash( $_GET['path'] ) ) || '/payments/onboarding' === sanitize_text_field( wp_unslash( $_GET['path'] ) ) ) &&
'wc-admin' === $_GET['page'];
// phpcs:enable
if ( $is_setting_page || $is_woopayments_connect ) {
// Regnerate the share key if it's not set.
add_option( 'woocommerce_share_key', wp_generate_password( 32, false ) );