Skip to content

Commit 58a274c

Browse files
senadirclaude
andcommitted
Use hasSelectedLocalPickup from useShippingData directly
Instead of manually checking for 'pickup_location' method_id which doesn't cover all local pickup methods, use the existing hasSelectedLocalPickup property from useShippingData hook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bf29941 commit 58a274c

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

  • plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block

plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@ const FrontendBlock = ( {
4040
const { showBillingFields, forcedBillingAddress, useBillingAsShipping } =
4141
useCheckoutAddress();
4242

43-
const { shippingRates } = useShippingData();
44-
45-
const hasSelectedLocalPickup = shippingRates.some( ( pkg ) =>
46-
pkg.shipping_rates.some(
47-
( rate ) => rate.method_id === 'pickup_location' && rate.selected
48-
)
49-
);
43+
const { hasSelectedLocalPickup } = useShippingData();
5044

5145
if ( ! showBillingFields && ! useBillingAsShipping ) {
5246
return null;

0 commit comments

Comments
 (0)