Local Pickup: Change location modal to have store country as default country

This commit is contained in:
Nadir Seghir 2022-12-23 13:26:06 +01:00
parent 994491c2b8
commit 549358c65c
4 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,7 @@ const LocationSettings = () => {
setPickupLocations, setPickupLocations,
toggleLocation, toggleLocation,
updateLocation, updateLocation,
readOnlySettings,
} = useSettingsContext(); } = useSettingsContext();
const [ editingLocation, setEditingLocation ] = const [ editingLocation, setEditingLocation ] =
useState< UniqueIdentifier >( '' ); useState< UniqueIdentifier >( '' );
@ -138,7 +139,7 @@ const LocationSettings = () => {
city: '', city: '',
state: '', state: '',
postcode: '', postcode: '',
country: '', country: readOnlySettings.storeCountry,
}, },
} }
: pickupLocations.find( ( { id } ) => { : pickupLocations.find( ( { id } ) => {

View File

@ -31,6 +31,7 @@ export type ShippingMethodSettings = {
}; };
export type ReadOnlySettings = { export type ReadOnlySettings = {
storeCountry: string;
hasLegacyPickup: boolean; hasLegacyPickup: boolean;
}; };

View File

@ -32,6 +32,7 @@ export const defaultSettings = {
export const defaultReadyOnlySettings = { export const defaultReadyOnlySettings = {
hasLegacyPickup: false, hasLegacyPickup: false,
storeCountry: '',
}; };
declare global { declare global {
const hydratedScreenSettings: { const hydratedScreenSettings: {

View File

@ -195,6 +195,7 @@ class ShippingController {
'pickupLocations' => $formatted_pickup_locations, 'pickupLocations' => $formatted_pickup_locations,
'readonlySettings' => array( 'readonlySettings' => array(
'hasLegacyPickup' => $has_legacy_pickup, 'hasLegacyPickup' => $has_legacy_pickup,
'storeCountry' => WC()->countries->get_base_country(),
), ),
); );