-
How to define half-day rental as a condition? I don’t find this option, in the rental market it is a normal option.
Hi!
The theme does not support hourly booking, only day or night. fields “Pick-up time” and “Drop-off time” are informational and are needed so that the customer can notify you at what time it is convenient for him to pick up or drop off the items. Just like when booking a hotel, you can specify the time of check-in in an acceptable interval and this will not affect the booking in any way.
The problem is that I have half-day prices, hotels don’t have that. How to solve it?
You have very specific conditions. The current capabilities of the theme do not allow this to be implemented.
You can use this hook (renroll_condition_check) to modify any condition:
add_filter( 'renroll_condition_check', function ( $satisfies_condition, $term_id, $start, $end, $day ) { /** * @var bool $satisfies_condition The $day satisfies the condition if true * @var int $term_id Condition ID * @var DateTime $start Start of the selected range * @var DateTime $end End of the selected range * @var DateTime $day The day from the selected range to check * */ // insert your code here ... return $satisfies_condition; }, 10, 5 );
You should create an empty condition and use its id (from the url) to write a filter hook
Using the variables $_POST[‘start_time’] and $_POST[‘end_time’], you can get the time specified in the form. And depending on the time and if one day is selected, then activate this condition (return true;). And for it, specify the appropriate price on the product page.
Thank you for the prompt response.
When you say “create an empty condition”, it´s on Catalog > Conditions? What name should have that condition?
Sample code for your review, please:
functions.php
add_filter( ‘renroll_condition_check’, function ( $satisfies_condition, $term_id, $start, $end, $day ) {
/**
* @var bool $satisfies_condition The $day satisfies the condition if true
* @var int $term_id Condition ID
* @var DateTime $start Start of the selected range
* @var DateTime $end End of the selected range
* @var DateTime $day The day from the selected range to check
*/// Get the time specified in the form
$start_time = isset( $_POST[‘start_time’] ) ? sanitize_text_field( $_POST[‘start_time’] ) : ”;
$end_time = isset( $_POST[‘end_time’] ) ? sanitize_text_field( $_POST[‘end_time’] ) : ”;// Custom logic to check conditions based on time and day
if ( $start_time && $end_time && $day ) {
// Activate the condition
$satisfies_condition = true;
}return $satisfies_condition;
}, 10, 5 );The name is not important, you need the ID of the new condition, which you can find in the URL.
You should add a check to the function that ID == $term_id
if ($term_id == 1234) { }
Please note that we do not provide paid services for theme modification, and we do not advise on modification. This is not included in the support.
You must be logged in to reply to this topic.