Skip to content

Commit

Permalink
Refactor force billing: remove forcedBillingAddress from conditions f…
Browse files Browse the repository at this point in the history
…or showBillingFields (woocommerce#7393)

Co-authored-by: Niels Lange <[email protected]>
  • Loading branch information
2 people authored and senadir committed Nov 12, 2022
1 parent a5d410b commit 38caed3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions assets/js/base/context/hooks/use-checkout-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ export const useCheckoutAddress = (): CheckoutAddress => {
useShippingAsBilling,
setUseShippingAsBilling: __internalSetUseShippingAsBilling,
showShippingFields: ! forcedBillingAddress && needsShipping,
showBillingFields:
forcedBillingAddress || ! needsShipping || ! useShippingAsBilling,
showBillingFields: ! needsShipping || ! useShippingAsBilling,
forcedBillingAddress,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ const FrontendBlock = ( {
showCompanyField,
showPhoneField,
} = useCheckoutBlockContext();
const { showBillingFields } = useCheckoutAddress();
const { showBillingFields, forcedBillingAddress } = useCheckoutAddress();

if ( ! showBillingFields ) {
if ( ! showBillingFields && ! forcedBillingAddress ) {
return null;
}

Expand Down

0 comments on commit 38caed3

Please sign in to comment.