System calculation at booking stage

Hi, is there a way for the theme to do calculations for a specific number of days and the number of guests based on the per day/night rate? Example 1 (Airbnb): Let’s say the base rate is $100 per night and the guest is booking 3 nights – the system should automatically make the total $300.

Example two: Example 1 (Booking.com): Let’s say the base rate is $100 per person per night and the guest is booking 3 nights for 2 people – the system should automatically make the total $600.

Yes, it should work this way by default, please enable multiple places per booking in settings and a new Places (Guests) field will appear. Then if the booking price is $100 and there are 3 nights and 2 guests, the total will be $600 (on checkout).

Hello Ihor ,

1st. I dont have setted by default price , when i put my price atributes , dosent calculate or show anything , whats the total price …
1.2 I Want to show the price on primary block and on secondary page
2nd . I want to get the value of atribute Maximum Places per Booking and show it on block ( secondary) and page (secondary )

1 ) Please use the default price field/attribute to set the price for listing

2, 3) Please try this PHP snippet

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		
		// Change price attribute position.
		if ( isset( $attributes['price'] ) ) {
			$attributes['price']['display_areas'] = ['view_block_primary',
				'view_page_secondary'];
		}
		
		// Change maximum places per booking attribute position and display format.
		if ( isset( $attributes['booking_max_quantity'] ) ) {
			$attributes['booking_max_quantity'] = array_merge(
				$attributes['booking_max_quantity'],
				[
					'display_areas' => 	['view_block_secondary', 'view_page_primary'],
					'display_format' => sprintf('Maximum places per booking %s', '%value%'),
				]
			);
		}
 
		return $attributes;
	},
	1000
);

sniper work perfrectly , thanks yevhen :slight_smile:
Unfortunaly i dont have setted atribute “price” be default , If i create a new one , and place “field name” on “price”. It will work or not ?

Im not sure if u understand what i asked . I want when u pass to booking confirm

For example , somewhere here , to be calculated : Total price

If you also use the Marketplace extension, the total price should be calculated on the listing page (e.g. if the dates or other fields are changed). There is no total price on the Add Details page yet, but we plan to improve this (the final price is also visible on the Checkout page if you use Marketplace).

Thank you

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