Attribute synchronization with location

Hello,

We are currently utilizing your product, ExpertHive, for our platform. While configuring the setup, we have encountered a specific challenge. On both the ‘vendors’ and ‘listing’ pages, we require a consolidated attribute. Presently, there is an option to create two distinct attributes for different segments (services and experts). However, our requirement is for a single attribute that serves as a unified filter for location. This attribute should display the service location on the card and enable us to filter and view all experts operating in the selected location.

Is it possible to merge or link the two attributes into a shared attribute, applicable across the ‘vendors’ and ‘listing’ sections?

To elaborate further, we are seeking to synchronize the data entered in the Location field of the vendor and the listing. Additionally, we would like to hide the field in the listing, ensuring that when a vendor specifies a location, it is automatically updated for all associated listings. By achieving this, we aim to enable seamless search functionality without manually adjusting the location for each listing. We understand that this information is already accessible through the API, but we believe a custom PHP snippet is required for synchronization.

Could you kindly provide insights or suggestions on how to proceed?

Thank you for your attention and assistance.

Thank you for waiting. Please try this PHP code snippet

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.