diff --git a/plugins/woocommerce/changelog/enhance-regenerate-share-key-on-the-fly b/plugins/woocommerce/changelog/enhance-regenerate-share-key-on-the-fly new file mode 100644 index 00000000000..41e7caa8aeb --- /dev/null +++ b/plugins/woocommerce/changelog/enhance-regenerate-share-key-on-the-fly @@ -0,0 +1,4 @@ +Significance: patch +Type: enhancement + +Regenerate share key on the fly diff --git a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php index 5d3bb3d356a..d166439b2c3 100644 --- a/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php +++ b/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php @@ -70,6 +70,9 @@ class LaunchYourStore { $is_setting_page = $current_screen && 'woocommerce_page_wc-settings' === $current_screen->id; if ( $is_setting_page ) { + // Regnerate the share key if it's not set. + add_option( 'woocommerce_share_key', wp_generate_password( 32, false ) ); + $settings['siteVisibilitySettings'] = array( 'shop_permalink' => get_permalink( wc_get_page_id( 'shop' ) ), 'woocommerce_coming_soon' => get_option( 'woocommerce_coming_soon' ),