Free and Premium WordPress Plugins & Themes Forums WordPress Plugins Hotel Booking Prices start at:
- This topic has 19 replies, 8 voices, and was last updated 1 year, 7 months ago by J. Davis.
- AuthorPosts
- March 22, 2019 at 8:56 pm #786537Nick ShemenskiParticipant
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
March 25, 2019 at 11:01 am #787079Stacy LindKeymasterOur 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 ), $taxesAndFees, $priceFortmatAtts, $defaultPriceForNights ); // 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.March 25, 2019 at 6:20 pm #787250Nick ShemenskiParticipantThank 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
March 27, 2019 at 8:33 am #787932Stacy LindKeymasterHi 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(); ?>
March 27, 2019 at 1:53 pm #788119Nick ShemenskiParticipantStacy,
Thank you.
April 21, 2020 at 2:53 pm #943682Edner ZephirParticipantHello,
I enjoyed this post. Thanks to Stacy and NickSo, with this trick how can Stacy help me achieve the following:
Minimum stay works in calendar only when I select all accommodation?
Example: https://viprealtymanagers.com/alquiler/accommodation/villa-vanilla/Scenario
1) Rule set only for this villa: https://prnt.sc/rynko6 > guest can select 1 day: https://prnt.sc/ryniyd. After checking for availability this villa not shown but it not make sense.
2) Rule set for all accommodation: https://prnt.sc/rynlbk > in this case, yes it works > https://prnt.sc/rynly5 | https://prnt.sc/rynmi0April 23, 2020 at 10:22 am #945559J. DavisKeymasterHi 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. DavisJanuary 19, 2022 at 8:32 pm #1246972William JepsonParticipantHow 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.
January 25, 2022 at 12:09 am #1249341J. DavisKeymasterHi 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.phpinstead of
mphb_tmpl_the_room_type_default_price
best regards,
J. DavisJune 11, 2022 at 11:43 am #1316536Gundula UrayParticipantCould this please be put behind a setting or even made the default. Otherwise it is really marketing gone wrong.
June 16, 2022 at 4:36 am #1318283Andre FloresModeratorHello 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,
AndreJuly 1, 2022 at 6:20 am #1322324Gundula UrayParticipantI 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 https://holapp.at/locations/rohrmoos-schladming/
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): https://holapp.at/locations/rohrmoos-schladming/
b) the german translation using wpml breaks and shows 900 for 1 night!! which is clearly wrong:
https://holapp.at/de/ort/rohrmoos/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.
July 3, 2022 at 10:35 pm #1325045J. DavisKeymasterHi 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. DavisJuly 7, 2022 at 6:47 am #1326618Gundula UrayParticipantThanks J.Davis. Could you please suggest a php hack for this:
https://holapp.at/locations/rohrmoos-schladming/
this is currently not covered by the two php hacks/modifications you guys noted above. it is still showing 3 nights in that section.
regards!July 8, 2022 at 1:41 am #1326880J. DavisKeymasterHi 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
/wp-content/themes/booklium/template-parts/content-taxonomy-mphb_room_type.php
– paste the file to the child theme
/wp-content/themes/booklium-child/template-parts/content-taxonomy-mphb_room_type.php
– open the file you have pasted with any text editor and placecustom_mphb_tmpl_the_room_type_default_price();
instead ofmphb_tmpl_the_room_type_default_price();
best regards,
J. Davis - AuthorPosts
- You must be logged in to reply to this topic.