How to merge the value of two attributes?

Hi,

How to merge the value of two attributes using a hook? I have two attributes, one is a select type and the other is a number, and I want to use one attribute to display two attributes at once.

something like this

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset( $attributes[number']) ) {
			$attributes['number']['display_format'] = '%value% '.$attributes['select']['display_format'];
	...

Can this be done with a snippet or is there another approach?

Hi,

Code changes may not be required in this case, if this attribute is added via the UI in Listings/Attributes, please try referencing another attribute value by adding a token to the display format, for example:

%value% %listing.anotherattributenamehere%

Hi Ihor,

Thank you! Its works!

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