Hello,
in my listings the hourly booking are listed like : $20 / hour, but when a user selects 2h it display $40 / hour is there a way when the user selects any option it changes the /hour to /total ?
This is the code i have :
add_action('hivepress/v1/models/listing/create', function($listing_id) {
if(hivepress()->get_version( 'bookings' )){
update_post_meta($listing_id, 'hp_booking_slot_duration', 60);
}
});
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset($attributes['booking_slot_duration']) ) {
$attributes['booking_slot_duration']['editable'] = false;
}
return $attributes;
},
1000
);
add_filter(
'hivepress/v1/models/listing/fields',
function( $fields, $listing ) {
if (hivepress()->get_version( 'bookings' ) && hivepress()->booking->is_time_enabled( $listing->get_id()) && isset( $fields['price'] ) ) {
$fields['price']['display_template'] = '%value% / hour';
}
return $fields;
},
1000,
2
);