Add an option for syncing the vendor location with listings

Hi! I use geolocation only in the vendor registration, but I need this address to be associated with all ads from this vendor.

The objective is to facilitate the process of posting the ad, preventing the vendor from having to enter his address for each ad he needs to create. In addition to facilitating the management of my site in relation to addresses.

Can you please implement this feature or provide a code snippet?

Thanks, this one is already planned, we plan to add the “sync” feature for selected vendor fields that will by in sync with listings, this will also resolve a “single location” issue.

Hi Ihor,
any idea when this will be live?

I found this snippet in the forum, but I don’t seem to see a synch between vendor and listings.

add_filter(
	'hivepress/v1/models/listing/attributes',
	function($attributes){
		if(isset($attributes['location'])){
			$attributes['location']['synced'] = true;
		}
		
		return $attributes;
	},
	1000
);

Hi,

We plan to release this feature according to the roadmap: Geolocation Roadmap – Asana

As for the PHP snippet, it looks good, try to re-save the vendor profile after you added this snippet. Alternatively, try re-saving the location field.

Thanks Andrii. It seems that actually all synched fields are having an error, so will create a new issue.

Works now, was a bug on another synched field which seemed to break all synched fields.

However, this syncing only updates the location attribute for the listing. It doesn’t integrate the synced location into the search functionality. As a result, when users search by location, the listings associated with that vendor’s location won’t appear in the results.

add_filter(
	'hivepress/v1/models/listing/attributes',
	function($attributes){
		if(isset($attributes['location'])){
			$attributes['location']['synced'] = true;
		}
		
		return $attributes;
	},
	1000
);