Refactor force billing: remove forcedBillingAddress from conditions for showBillingFields (https://github.com/woocommerce/woocommerce-blocks/pull/7393)

Co-authored-by: Niels Lange <info@nielslange.de>
This commit is contained in:
Tarun Vijwani 2022-10-14 14:29:06 +04:00 committed by GitHub
parent aa8622d985
commit 9167a04e20
2 changed files with 3 additions and 4 deletions

View File

@ -90,8 +90,7 @@ export const useCheckoutAddress = (): CheckoutAddress => {
useShippingAsBilling,
setUseShippingAsBilling: __internalSetUseShippingAsBilling,
showShippingFields: ! forcedBillingAddress && needsShipping,
showBillingFields:
forcedBillingAddress || ! needsShipping || ! useShippingAsBilling,
showBillingFields: ! needsShipping || ! useShippingAsBilling,
forcedBillingAddress,
};
};

View File

@ -38,9 +38,9 @@ const FrontendBlock = ( {
showCompanyField,
showPhoneField,
} = useCheckoutBlockContext();
const { showBillingFields } = useCheckoutAddress();
const { showBillingFields, forcedBillingAddress } = useCheckoutAddress();
if ( ! showBillingFields ) {
if ( ! showBillingFields && ! forcedBillingAddress ) {
return null;
}