diff --git a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/index.tsx b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/index.tsx
index a213f795f71..40423ece0cd 100644
--- a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/index.tsx
+++ b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/index.tsx
@@ -10,7 +10,7 @@ import { isPackageRateCollectable } from '@woocommerce/base-utils';
* Shows a formatted pickup location.
*/
const PickupLocation = (): JSX.Element | null => {
- const { pickupAddress, pickupMethod } = useSelect( ( select ) => {
+ const { pickupAddress } = useSelect( ( select ) => {
const cartShippingRates = select( 'wc/store/cart' ).getShippingRates();
const flattenedRates = cartShippingRates.flatMap(
@@ -36,7 +36,6 @@ const PickupLocation = (): JSX.Element | null => {
const selectedRatePickupAddress = selectedRateMetaData.value;
return {
pickupAddress: selectedRatePickupAddress,
- pickupMethod: selectedCollectableRate.name,
};
}
}
@@ -44,20 +43,15 @@ const PickupLocation = (): JSX.Element | null => {
if ( isObject( selectedCollectableRate ) ) {
return {
pickupAddress: undefined,
- pickupMethod: selectedCollectableRate.name,
};
}
return {
pickupAddress: undefined,
- pickupMethod: undefined,
};
} );
// If the method does not contain an address, or the method supporting collection was not found, return early.
- if (
- typeof pickupAddress === 'undefined' &&
- typeof pickupMethod === 'undefined'
- ) {
+ if ( typeof pickupAddress === 'undefined' ) {
return null;
}
@@ -67,9 +61,7 @@ const PickupLocation = (): JSX.Element | null => {
{ sprintf(
/* translators: %s: shipping method name, e.g. "Amazon Locker" */
__( 'Collection from %s', 'woo-gutenberg-products-block' ),
- typeof pickupAddress === 'undefined'
- ? pickupMethod
- : pickupAddress
+ pickupAddress
) + ' ' }
);
diff --git a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/test/index.tsx b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/test/index.tsx
index 603bb951931..31f81fa80ac 100644
--- a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/test/index.tsx
+++ b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/pickup-location/test/index.tsx
@@ -26,7 +26,7 @@ jest.mock( '@woocommerce/settings', () => {
};
} );
describe( 'PickupLocation', () => {
- it( `renders an address if one is set in the method's metadata`, async () => {
+ it( `renders an address if one is set in the methods metadata`, async () => {
dispatch( CHECKOUT_STORE_KEY ).setPrefersCollection( true );
// Deselect the default selected rate and select pickup_location:1 rate.
@@ -54,7 +54,7 @@ describe( 'PickupLocation', () => {
)
).toBeInTheDocument();
} );
- it( 'renders the method name if address is not in metadata', async () => {
+ it( 'renders no address if one is not set in the methods metadata', async () => {
dispatch( CHECKOUT_STORE_KEY ).setPrefersCollection( true );
// Deselect the default selected rate and select pickup_location:1 rate.
@@ -87,7 +87,7 @@ describe( 'PickupLocation', () => {
render(