fix: set shipping defaults when address details not filled out (#34610)
This commit is contained in:
parent
1314ad4ca3
commit
d191ecc275
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: fix
|
||||
|
||||
Shipping defaults is now set when the user completes onboarding profiler, even if they did not set their address details
|
|
@ -97,9 +97,15 @@ class Homescreen {
|
|||
return $settings;
|
||||
}
|
||||
|
||||
$user_skipped_obw = $settings['onboarding']['profile']['skipped'] ?? false;
|
||||
$store_address = $settings['preloadSettings']['general']['woocommerce_store_address'] ?? '';
|
||||
$product_types = $settings['onboarding']['profile']['product_types'] ?? array();
|
||||
$user_skipped_obw = $settings['onboarding']['profile']['skipped'] ?? false;
|
||||
$store_address = $settings['preloadSettings']['general']['woocommerce_store_address'] ?? '';
|
||||
$product_types = $settings['onboarding']['profile']['product_types'] ?? array();
|
||||
$user_has_set_store_country = $settings['onboarding']['profile']['is_store_country_set'] ?? false;
|
||||
|
||||
// Do not proceed if user has not filled out their country in the onboarding profiler.
|
||||
if ( ! $user_has_set_store_country ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
// If user skipped the obw or has not completed the store_details
|
||||
// then we assume the user is going to sell physical products.
|
||||
|
@ -114,13 +120,6 @@ class Homescreen {
|
|||
$country_code = wc_format_country_state_string( $settings['preloadSettings']['general']['woocommerce_default_country'] )['country'];
|
||||
$country_name = WC()->countries->get_countries()[ $country_code ] ?? null;
|
||||
|
||||
// we also need to make sure woocommerce_store_address is not empty
|
||||
// to make sure store country is set by an actual user
|
||||
// since woocommerce_store_address is set to US:CA by default.
|
||||
if ( '' === $country_code || null === $country_name || '' === $store_address ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$is_jetpack_installed = in_array( 'jetpack', $settings['plugins']['installedPlugins'] ?? array(), true );
|
||||
$is_wcs_installed = in_array( 'woocommerce-services', $settings['plugins']['installedPlugins'] ?? array(), true );
|
||||
|
||||
|
|
Loading…
Reference in New Issue