Display booking settings in the secondary attributes area

Hi HivePress team,

2023-01-14

  1. Is there any snippet to show these three attributes on Page (secondary)? I already made them mandatory, but I would like the guests to know the values, so they won’t be wondering why they cannot book just 1 night (if min is set to 2 nights) or 30 nights (if max is set to 28) or book more than 90 days in advance (when the max is set to 60).

  1. If it is possible, would it be possible to add icons and also to choose the order, so it won’t be at a random place, e.g., between Bedrooms and Bathrooms?

  2. Is it possible to change the attribute’s names and descriptions?

  3. Also, is there a possibility to change Booking note description?

2023-01-14 (2)

I was looking if there is a topic about it already, but didn’t find any.

Thanks a lot for your help.

Hi,

It’s possible, but customizing the built-in fields this way (those fields added by extensions automatically) requires custom code snippets. If you’re familiar with coding basics, please try defining the _display_areas and display_template parameters for these fields.

Hi Ihor,

Thank you, but unfortunately I am not familiar with coding at all :-/

Are there at least any “easy” snippets to rename these attributes and change their descriptions (Booking window, Minimum and Maximum booking duration and Booking note), or does it need customizing as well?

Thank you.

Hi,

If you need to change their descriptions, please try this PHP snippet:

add_filter( 'hivepress/v1/models/listing/attributes', 'custom_change_listing_attributes', 1000 );
add_filter( 'hivepress/v1/models/vendor/attributes', 'custom_change_listing_attributes', 1000 );

function custom_change_listing_attributes( $attributes ) {
 
  // Minimum Booking Duration field description.
  if ( isset( $attributes['booking_min_length'] ) ) {
   $attributes['booking_min_length']['edit_field']['description'] = 'custom text here';
  }
  
  // Maximum Booking Duration field description.
  if ( isset( $attributes['booking_max_length'] ) ) {
   $attributes['booking_max_length']['edit_field']['description'] = 'custom text here';
  }
  
  // Booking Window field description.
  if ( isset( $attributes['booking_window'] ) ) {
   $attributes['booking_window']['edit_field']['description'] = 'custom text here';
  }
  
  // Booking Note field description.
  if ( isset( $attributes['purchase_note'] ) ) {
   $attributes['purchase_note']['edit_field']['description'] = 'custom text here';
  }
 
  return $attributes;
}

To rename these attributes, please use Loco Translate (How to translate an extension - HivePress Help Center).

If customizations are required for your site, please try customizing it using the collection of code snippets Search · user:hivepress · GitHub and other developer resources, or consider hiring someone for custom work https://fvrr.co/32e7LvY

Thank you Andrii. It works.