diff --git a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/shipping-rates-control-package/index.tsx b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/shipping-rates-control-package/index.tsx index 306007b373a..9e5e15c636c 100644 --- a/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/shipping-rates-control-package/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/base/components/cart-checkout/shipping-rates-control-package/index.tsx @@ -13,6 +13,7 @@ import { useStoreEvents, } from '@woocommerce/base-context/hooks'; import { sanitizeHTML } from '@woocommerce/utils'; +import { debounce } from 'lodash'; /** * Internal dependencies @@ -90,14 +91,17 @@ export const ShippingRatesControlPackage = ( { ) } ); - const onSelectRate = useCallback( - ( newShippingRateId: string ) => { - selectShippingRate( newShippingRateId, packageId ); - dispatchCheckoutEvent( 'set-selected-shipping-rate', { - shippingRateId: newShippingRateId, - } ); - }, - [ dispatchCheckoutEvent, packageId, selectShippingRate ] + const onSelectRate = debounce( + useCallback( + ( newShippingRateId: string ) => { + selectShippingRate( newShippingRateId, packageId ); + dispatchCheckoutEvent( 'set-selected-shipping-rate', { + shippingRateId: newShippingRateId, + } ); + }, + [ dispatchCheckoutEvent, packageId, selectShippingRate ] + ), + 1000 ); const packageRatesProps = { className,