Map facet – remove duplicate map markers

<?php

// Add to your (child) theme's functions.php
// Note that this is untested, and may have side effects!

add_filter( 'facetwp_map_marker_args', function( $args, $post_id ) {
    if ( ! isset( FWP()->map_locations ) ) {
        FWP()->map_locations = [];
    }

    // generate the hash for checking duplicates
    $hash = $args['position']['lat'] . ':' . $args['position']['lng'];

    // skip if this exact location has already been used
    if ( isset( FWP()->map_locations[ $hash ] ) ) {
        return false;
    }

    FWP()->map_locations[ $hash ] = true;
    return $args;
}, 10, 2 );