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;
|
||||
useBillingAsShipping: boolean;
|
||||
needsShipping: boolean;
|
||||
showShippingMethods: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,6 +99,7 @@ export const useCheckoutAddress = (): CheckoutAddress => {
|
|||
needsShipping,
|
||||
showShippingFields:
|
||||
! forcedBillingAddress && needsShipping && ! prefersCollection,
|
||||
showShippingMethods: needsShipping && ! prefersCollection,
|
||||
showBillingFields:
|
||||
! needsShipping || ! useShippingAsBilling || prefersCollection,
|
||||
forcedBillingAddress,
|
||||
|
|
|
@ -46,9 +46,9 @@ export const Edit = ( {
|
|||
'activeShippingZones'
|
||||
) as shippingAdminLink[];
|
||||
|
||||
const { showShippingFields } = useCheckoutAddress();
|
||||
const { showShippingMethods } = useCheckoutAddress();
|
||||
|
||||
if ( ! showShippingFields ) {
|
||||
if ( ! showShippingMethods ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,18 +32,12 @@ const FrontendBlock = ( {
|
|||
children: JSX.Element;
|
||||
className?: string;
|
||||
} ) => {
|
||||
const { checkoutIsProcessing, prefersCollection } = useSelect(
|
||||
( select ) => {
|
||||
const checkoutStore = select( CHECKOUT_STORE_KEY );
|
||||
return {
|
||||
checkoutIsProcessing: checkoutStore.isProcessing(),
|
||||
prefersCollection: checkoutStore.prefersCollection(),
|
||||
};
|
||||
}
|
||||
const checkoutIsProcessing = useSelect( ( select ) =>
|
||||
select( CHECKOUT_STORE_KEY ).isProcessing()
|
||||
);
|
||||
const { needsShipping } = useCheckoutAddress();
|
||||
const { showShippingMethods } = useCheckoutAddress();
|
||||
|
||||
if ( ! needsShipping || prefersCollection ) {
|
||||
if ( ! showShippingMethods ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue