Don't show store location in the tax and shipping tasks if it's already been provided (https://github.com/woocommerce/woocommerce-admin/pull/4507)

Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
Bec Scott 2020-06-15 09:20:52 +10:00 committed by GitHub
parent e7ea3757e2
commit 07222c08ff
2 changed files with 28 additions and 2 deletions

View File

@ -111,7 +111,12 @@ class Shipping extends Component {
}
componentDidUpdate( prevProps, prevState ) {
const { countryCode } = this.props;
const { countryCode, settings } = this.props;
const {
woocommerce_store_address: storeAddress,
woocommerce_default_country: defaultCountry,
woocommerce_store_postcode: storePostCode,
} = settings;
const { step } = this.state;
if (
@ -121,6 +126,14 @@ class Shipping extends Component {
) {
this.fetchShippingZones();
}
const isCompleteAddress = Boolean(
storeAddress && defaultCountry && storePostCode
);
if ( step === 'store_location' && isCompleteAddress ) {
this.completeStep();
}
}
completeStep() {

View File

@ -95,7 +95,12 @@ class Tax extends Component {
taxSettings,
isGeneralSettingsRequesting,
} = this.props;
const { woocommerce_calc_taxes: calcTaxes } = generalSettings;
const {
woocommerce_calc_taxes: calcTaxes,
woocommerce_store_address: storeAddress,
woocommerce_default_country: defaultCountry,
woocommerce_store_postcode: storePostCode,
} = generalSettings;
const { stepIndex } = this.state;
const currentStep = this.getSteps()[ stepIndex ];
const currentStepKey = currentStep && currentStep.key;
@ -132,6 +137,14 @@ class Tax extends Component {
this.completeStep();
}
const isCompleteAddress = Boolean(
storeAddress && defaultCountry && storePostCode
);
if ( currentStepKey === 'store_location' && isCompleteAddress ) {
this.completeStep();
}
const {
woocommerce_calc_taxes: prevCalcTaxes,
} = prevProps.generalSettings;