Fix 'cannot read property' error from ExPlat (https://github.com/woocommerce/woocommerce-admin/pull/7600)
* Change option value path * Try wcSettings.preloadSettings.general first * Add changelog
This commit is contained in:
parent
e6833b19eb
commit
ccdd32282d
|
@ -1,3 +1,7 @@
|
|||
# Unreleased
|
||||
|
||||
- Fix an error when getting woocommerce_default_country value. #7600
|
||||
- Attempts to get the woocommerce_default_country value in wcSettings.preloadSettings.general first for the backward compatibility #7600
|
||||
# 1.1.3
|
||||
|
||||
- Retry fix for missing build-module folder
|
||||
|
|
|
@ -22,8 +22,10 @@ export const fetchExperimentAssignment = async ( {
|
|||
experiment_name: experimentName,
|
||||
anon_id: anonId ?? undefined,
|
||||
woo_country_code:
|
||||
window.wcSettings.preloadSettings.general
|
||||
.woocommerce_default_country,
|
||||
window.wcSettings?.preloadSettings?.general
|
||||
?.woocommerce_default_country ||
|
||||
window.wcSettings?.admin?.preloadSettings?.general
|
||||
?.woocommerce_default_country,
|
||||
} );
|
||||
|
||||
const response = await window.fetch(
|
||||
|
|
|
@ -10,10 +10,15 @@ interface generalSettings {
|
|||
interface preloadSettings {
|
||||
general: generalSettings;
|
||||
}
|
||||
|
||||
interface wcSettings {
|
||||
interface admin {
|
||||
preloadSettings: preloadSettings;
|
||||
}
|
||||
|
||||
interface wcSettings {
|
||||
admin: admin;
|
||||
preloadSettings: preloadSettings;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
wcSettings: wcSettings;
|
||||
|
|
Loading…
Reference in New Issue