Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Forked from g-maclean/snippet.php
Last active May 5, 2026 07:46
Show Gist options
  • Select an option

  • Save propertyhive/bc79d5416c936503f63a4c1190dc2f7a to your computer and use it in GitHub Desktop.

Select an option

Save propertyhive/bc79d5416c936503f63a4c1190dc2f7a to your computer and use it in GitHub Desktop.
Property Hive - Real time feed - override To Rent price qualifier
add_filter( 'ph_rtdf_send_request_data', 'set_price_qualifier_for_commercial_rent_rtdf', 10, 2 );
function set_price_qualifier_for_commercial_rent_rtdf( $request_data, $post_id )
{
$property = new PH_Property( $post_id );
if ( ! $property )
{
return $request_data;
}
$original_department = $property->department;
// Check if department is commercial
if (
$original_department === 'commercial' ||
ph_get_custom_department_based_on( $original_department ) === 'commercial'
) {
// Check if property is to rent AND for sale
if (
$property->to_rent === 'yes' &&
$property->for_sale === 'yes'
) {
if (
isset($request_data['branch']['channel']) &&
$request_data['branch']['channel'] === 2 &&
isset( $request_data['property']['price_information']['price_qualifier'] )
) {
unset( $request_data['property']['price_information']['price_qualifier'] );
}
if (
isset($request_data['branch']['channel']) &&
$request_data['branch']['channel'] === 1
) {
// Check if price qualifier is 'Non-Quoting'
$terms = wp_get_post_terms( $post_id, 'price_qualifier' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
if ( strtolower( $term->name ) === 'non-quoting' ) {
$request_data['property']['price_information']['price_qualifier'] = 1; // Set to POA
break;
}
}
}
}
}
}
return $request_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment