Local Pickup: Fix render logic for regular shipping rates
This commit is contained in:
parent
612ddb34d2
commit
7bfda113b0
|
@ -98,7 +98,6 @@ const ShippingRatesControl = ( {
|
||||||
};
|
};
|
||||||
const { isEditor } = useEditorContext();
|
const { isEditor } = useEditorContext();
|
||||||
const { hasSelectedLocalPickup } = useShippingData();
|
const { hasSelectedLocalPickup } = useShippingData();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoadingMask
|
<LoadingMask
|
||||||
isLoading={ isLoadingRates }
|
isLoading={ isLoadingRates }
|
||||||
|
@ -109,21 +108,21 @@ const ShippingRatesControl = ( {
|
||||||
showSpinner={ true }
|
showSpinner={ true }
|
||||||
>
|
>
|
||||||
<ExperimentalOrderShippingPackages.Slot { ...slotFillProps } />
|
<ExperimentalOrderShippingPackages.Slot { ...slotFillProps } />
|
||||||
|
{ hasSelectedLocalPickup &&
|
||||||
|
shippingRates.length > 1 &&
|
||||||
|
! isEditor && (
|
||||||
|
<StoreNotice
|
||||||
|
className="wc-block-components-notice"
|
||||||
|
isDismissible={ false }
|
||||||
|
status="warning"
|
||||||
|
>
|
||||||
|
{ __(
|
||||||
|
'Multiple shipments must have the same pickup location',
|
||||||
|
'woo-gutenberg-products-block'
|
||||||
|
) }
|
||||||
|
</StoreNotice>
|
||||||
|
) }
|
||||||
<ExperimentalOrderShippingPackages>
|
<ExperimentalOrderShippingPackages>
|
||||||
{ hasSelectedLocalPickup &&
|
|
||||||
shippingRates.length > 1 &&
|
|
||||||
! isEditor && (
|
|
||||||
<StoreNotice
|
|
||||||
className="wc-block-components-notice"
|
|
||||||
isDismissible={ false }
|
|
||||||
status="warning"
|
|
||||||
>
|
|
||||||
{ __(
|
|
||||||
'Multiple shipments must have the same pickup location',
|
|
||||||
'woo-gutenberg-products-block'
|
|
||||||
) }
|
|
||||||
</StoreNotice>
|
|
||||||
) }
|
|
||||||
<Packages
|
<Packages
|
||||||
packages={ shippingRates }
|
packages={ shippingRates }
|
||||||
noResultsMessage={ noResultsMessage }
|
noResultsMessage={ noResultsMessage }
|
||||||
|
|
|
@ -33,6 +33,7 @@ interface CheckoutAddress {
|
||||||
showBillingFields: boolean;
|
showBillingFields: boolean;
|
||||||
forcedBillingAddress: boolean;
|
forcedBillingAddress: boolean;
|
||||||
useBillingAsShipping: boolean;
|
useBillingAsShipping: boolean;
|
||||||
|
needsShipping: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,6 +95,7 @@ export const useCheckoutAddress = (): CheckoutAddress => {
|
||||||
defaultAddressFields,
|
defaultAddressFields,
|
||||||
useShippingAsBilling,
|
useShippingAsBilling,
|
||||||
setUseShippingAsBilling: __internalSetUseShippingAsBilling,
|
setUseShippingAsBilling: __internalSetUseShippingAsBilling,
|
||||||
|
needsShipping,
|
||||||
showShippingFields:
|
showShippingFields:
|
||||||
! forcedBillingAddress && needsShipping && ! prefersCollection,
|
! forcedBillingAddress && needsShipping && ! prefersCollection,
|
||||||
showBillingFields:
|
showBillingFields:
|
||||||
|
|
|
@ -32,12 +32,18 @@ const FrontendBlock = ( {
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
className?: string;
|
className?: string;
|
||||||
} ) => {
|
} ) => {
|
||||||
const checkoutIsProcessing = useSelect( ( select ) =>
|
const { checkoutIsProcessing, prefersCollection } = useSelect(
|
||||||
select( CHECKOUT_STORE_KEY ).isProcessing()
|
( select ) => {
|
||||||
|
const checkoutStore = select( CHECKOUT_STORE_KEY );
|
||||||
|
return {
|
||||||
|
checkoutIsProcessing: checkoutStore.isProcessing(),
|
||||||
|
prefersCollection: checkoutStore.prefersCollection(),
|
||||||
|
};
|
||||||
|
}
|
||||||
);
|
);
|
||||||
const { showShippingFields, useBillingAsShipping } = useCheckoutAddress();
|
const { needsShipping } = useCheckoutAddress();
|
||||||
|
|
||||||
if ( ! showShippingFields && ! useBillingAsShipping ) {
|
if ( ! needsShipping || prefersCollection ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue