Prices start at:

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
  • #786537
    Nick Shemenski

    Currently on the availability page it shows:

    Prices start at: $447 for 3 nights

    I would like it to show the rate for one night, not 3 nights.
    In the settings I have a minimum stay set to 3 nights.
    How can I have it show a single night rate?

    Thank you

    Stacy Lind

    Our plugin cannot display prices per one night if you have minimum stay rules. This would require a custom solution. Here is how you can customize it:
    1. Add the following to wp-content\themes\your-child-theme\functions.php:

    function custom_mphb_tmpl_the_room_type_default_price( $id = null ){
    	$roomType = $id ? MPHB()->getRoomTypeRepository()->findById( $id ) : MPHB()->getCurrentRoomType();
    	$nights = 1;
    	$price  = mphb_get_room_type_base_price( $roomType );
    	$defaultPriceForNights = $price * $nights;
    	$taxesAndFees = $roomType->getTaxesAndFees();
    	$taxesAndFees->setRoomPrice( $defaultPriceForNights );
    	$taxesAndFees->setupParams( array(
    		'period_nights' => $nights,
    		'defined' => false
    	) );
    	$title = __( 'Choose dates to see relevant prices', 'motopress-hotel-booking' );
    	$priceFortmatAtts = array(
    		'period'		 => true,
    		'period_nights'	 => $nights,
    		'period_title'	 => $title
    	 * @since 3.9.8
    	 * @param float $defaultPriceForNights
    	 * @param \MPHB\TaxesAndFees\TaxesAndFees
    	 * @param array $priceFortmatAtts
    	 * @param float $defaultPriceForNights
    	$formattedPrice = apply_filters( 'mphb_tmpl_the_room_type_price_for_dates',
    		mphb_format_price( $defaultPriceForNights, $priceFortmatAtts ),
    	// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    	echo $formattedPrice;

    2. Copy wp-content\plugins\motopress-hotel-booking\templates\loop-room-type\price.php into wp-content\themes\your-child-theme\hotel-booking\loop-room-type\price.php.
    3. In wp-content\themes\your-child-theme\hotel-booking\loop-room-type\price.php change the line 19 to the following:
    <?php custom_mphb_tmpl_the_room_type_default_price(); ?>
    It will always display prices per night unless your customer searchers for specific dates. We could also customize the code for you with the extended support offer.

    Nick Shemenski

    Thank you. That worked great.

    Can I also change it on the accommodation/beach-cottage/ page?
    Beach Cottage is the name of my accommodation.

    It still shows the 3 nights price there.

    Thank you

    Stacy Lind

    Hi Nick,

    1. Copy \wp-content\plugins\motopress-hotel-booking\templates\single-room-type\price.php into wp-content\themes\your-child-theme\hotel-booking\single-room-type\price.php.
    2. In wp-content\themes\your-child-theme\hotel-booking\single-room-type\price.php change the line 19 to the following:
    <?php custom_mphb_tmpl_the_room_type_default_price(); ?>

    Nick Shemenski


    Thank you.

    Edner Zephir

    I enjoyed this post. Thanks to Stacy and Nick

    So, with this trick how can Stacy help me achieve the following:

    Minimum stay works in calendar only when I select all accommodation?


    1) Rule set only for this villa: > guest can select 1 day: After checking for availability this villa not shown but it not make sense.
    2) Rule set for all accommodation: > in this case, yes it works > |

    J. Davis

    Hi Edner,

    In order to display and reflect the booking rules of certain accommodation type you should enable Skip Search results option at Accommodation > Settings. Then the date pick calendar will display available and not available dates of each accommodation type.

    best regards,
    J. Davis

    William Jepson

    How can I also show the 1 night price on the homepage slider widget? Above code worked on 3 column accomodation but still shows 3 night price on slider widget.

    J. Davis

    Hi William,

    You may try to add a custom function name custom_mphb_tmpl_the_room_type_default_price in the following file \wp-content\plugins\motopress-hotel-booking\templates\widgets\rooms\room-content.php

    instead of


    best regards,
    J. Davis

    Gundula Uray

    Could this please be put behind a setting or even made the default. Otherwise it is really marketing gone wrong.

    Andre Flores

    Hello Gundula,

    Currently this is how the pricing functions by default in case you have a minimum stay rule set up.
    We might consider implementing this option in one of the plugin future updates.

    Best regards,

    Gundula Uray

    I have added the PHP hacks you suggested and it works in soe places. The motopress theme allows to filter by LOCATION as well and this is where it breaks and it still shows the price for 3 nights instead of showing the price for 1 night. See

    While the same appartement on this page is already showing the PER NIGHT PRICE.

    Pretty sure this needs another PHP hack in another place. This is pretty tedious and does not work in all places.

    What is worse is that the current implementation breaks with WPML multi lingual sites:
    a) the english site works fine and shows a price of 900 for 3 nights for the first appartement (appartement home TRINKER):
    b) the german translation using wpml breaks and shows 900 for 1 night!! which is clearly wrong:

    This is not a user friendly implementation. Fiddling with php is not something one of your clients should be doing pls even the current hacks do not cater for all instances and need further fiddling with php.

    Please please please put this under a setting that is clearly implemented, documented and tested by QA.

    J. Davis

    Hi Gundula,

    Thanks for your feedback. I’ve added your request to our list of features. We will notify you if we have any news about it.

    best regards,
    J. Davis

    Gundula Uray

    Thanks J.Davis. Could you please suggest a php hack for this:

    this is currently not covered by the two php hacks/modifications you guys noted above. it is still showing 3 nights in that section.

    J. Davis

    Hi Gundula,

    Since there was added custom archive page in the Booklium theme you will need to update the name of the function following the steps below:

    – go to the booklium-child theme folder on your server and open it
    – create template-parts folder
    – copy the following file from the parent theme folder
    – paste the file to the child theme
    – open the file you have pasted with any text editor and place custom_mphb_tmpl_the_room_type_default_price(); instead of mphb_tmpl_the_room_type_default_price();

    best regards,
    J. Davis

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.