Local Pickup: hide regular shipping rates when Local pickup is selected.
This commit is contained in:
parent
7bfda113b0
commit
5076541597
|
@ -34,6 +34,7 @@ interface CheckoutAddress {
|
||||||
forcedBillingAddress: boolean;
|
forcedBillingAddress: boolean;
|
||||||
useBillingAsShipping: boolean;
|
useBillingAsShipping: boolean;
|
||||||
needsShipping: boolean;
|
needsShipping: boolean;
|
||||||
|
showShippingMethods: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,6 +99,7 @@ export const useCheckoutAddress = (): CheckoutAddress => {
|
||||||
needsShipping,
|
needsShipping,
|
||||||
showShippingFields:
|
showShippingFields:
|
||||||
! forcedBillingAddress && needsShipping && ! prefersCollection,
|
! forcedBillingAddress && needsShipping && ! prefersCollection,
|
||||||
|
showShippingMethods: needsShipping && ! prefersCollection,
|
||||||
showBillingFields:
|
showBillingFields:
|
||||||
! needsShipping || ! useShippingAsBilling || prefersCollection,
|
! needsShipping || ! useShippingAsBilling || prefersCollection,
|
||||||
forcedBillingAddress,
|
forcedBillingAddress,
|
||||||
|
|
|
@ -46,9 +46,9 @@ export const Edit = ( {
|
||||||
'activeShippingZones'
|
'activeShippingZones'
|
||||||
) as shippingAdminLink[];
|
) as shippingAdminLink[];
|
||||||
|
|
||||||
const { showShippingFields } = useCheckoutAddress();
|
const { showShippingMethods } = useCheckoutAddress();
|
||||||
|
|
||||||
if ( ! showShippingFields ) {
|
if ( ! showShippingMethods ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,18 +32,12 @@ const FrontendBlock = ( {
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
className?: string;
|
className?: string;
|
||||||
} ) => {
|
} ) => {
|
||||||
const { checkoutIsProcessing, prefersCollection } = useSelect(
|
const checkoutIsProcessing = useSelect( ( select ) =>
|
||||||
( select ) => {
|
select( CHECKOUT_STORE_KEY ).isProcessing()
|
||||||
const checkoutStore = select( CHECKOUT_STORE_KEY );
|
|
||||||
return {
|
|
||||||
checkoutIsProcessing: checkoutStore.isProcessing(),
|
|
||||||
prefersCollection: checkoutStore.prefersCollection(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
const { needsShipping } = useCheckoutAddress();
|
const { showShippingMethods } = useCheckoutAddress();
|
||||||
|
|
||||||
if ( ! needsShipping || prefersCollection ) {
|
if ( ! showShippingMethods ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue