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, useShippingAsBilling,
setUseShippingAsBilling: __internalSetUseShippingAsBilling, setUseShippingAsBilling: __internalSetUseShippingAsBilling,
showShippingFields: ! forcedBillingAddress && needsShipping, showShippingFields: ! forcedBillingAddress && needsShipping,
showBillingFields: showBillingFields: ! needsShipping || ! useShippingAsBilling,
forcedBillingAddress || ! needsShipping || ! useShippingAsBilling,
forcedBillingAddress, forcedBillingAddress,
}; };
}; };

View File

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