: false, 'cost' => '' === $settings['cost'] ? 0 : $settings['cost'], 'taxes' => $settings['tax_status'], 'total_pickup_locations' => count( $locations ), 'pickup_locations_enabled' => count( array_filter( $locations, function( $location ) { return $location['enabled']; } ) ), ); WC_Tracks::record_event( $event_name, $data ); return $served; } /** * Check if legacy local pickup is activated in any of the shipping zones or in the Rest of the World zone. * * @since 8.8.0 * * @return bool */ public static function is_legacy_local_pickup_active() { $rest_of_the_world = \WC_Shipping_Zones::get_zone_by( 'zone_id', 0 ); $shipping_zones = \WC_Shipping_Zones::get_zones(); $rest_of_the_world_data = $rest_of_the_world->get_data(); $rest_of_the_world_data['shipping_methods'] = $rest_of_the_world->get_shipping_methods(); array_unshift( $shipping_zones, $rest_of_the_world_data ); foreach ( $shipping_zones as $zone ) { foreach ( $zone['shipping_methods'] as $method ) { if ( 'local_pickup' === $method->id && $method->is_enabled() ) { return true; } } } return false; } }