Here is the complete, updated solution, which I pieced together, without having to modify any core plugin files:
1) Install Categories Images plugin and add some images to your Store Categories.
2) Copy wpsl-gmap.js to your Child Theme, replace this lines in addMarker():
url = markerSettings.url + wpslSettings.storeMarker;
with:
// Edit here: Use category image as marker
if( infoWindowData.categoryMarkerUrl ) {
url = infoWindowData.categoryMarkerUrl;
} else {
url = markerSettings.url + wpslSettings.storeMarker;
}
3) In functions.php, load your modified javascript instead of the plugin’s:
/* see https://stackoverflow.com/a/29307618 */
function prefix_child_replace_wpsl_script() {
global $wp_scripts;
$wp_scripts->registered[ 'wpsl-js' ]->src = get_stylesheet_directory_uri() . '/js/wpsl-gmap.js';
}
add_action( 'wp_footer', 'prefix_replace_wpsl_script' );
4) Also in functions.php:
add_filter( 'wpsl_store_meta', 'prefix_store_meta', 10, 2 );
function prefix_store_meta( $store_meta, $store_id ) {
$terms = wp_get_post_terms( $store_id, 'wpsl_store_category' );
$store_meta['terms'] = '';
if ( $terms ) {
if ( !is_wp_error( $terms ) ) {
// Just use the first category found
if( function_exists('z_taxonomy_image_url') ) {
$store_meta['categoryMarkerUrl'] = z_taxonomy_image_url($terms[0]->term_id);
}
}
}
return $store_meta;
}
add_filter( 'wpsl_frontend_meta_fields', 'prefix_frontend_meta_fields' );
function prefix_frontend_meta_fields( $store_fields ) {
$store_fields['wpsl_categoryMarkerUrl'] = array(
'name' => 'categoryMarkerUrl'
);
return $store_fields;
}