Skip to content

Instantly share code, notes, and snippets.

@anhskohbo
Last active August 20, 2018 05:53
Show Gist options
  • Save anhskohbo/26decf9426f3f4d82be16712b22cceab to your computer and use it in GitHub Desktop.
Save anhskohbo/26decf9426f3f4d82be16712b22cceab to your computer and use it in GitHub Desktop.
Custom rate
add_action( 'abrs_setup_room_rate', function ( $room_rate ) {
/* @var $room_rate \AweBooking\Availability\Room_Rate */
$request = $room_rate->get_request();
$request_adults = $request
->get_guest_counts()
->get_adults()
->get_count();
if ( ( $extra_adults = $request_adults - 1 ) > 0 ) {
$custom_rate = new \AweBooking\Model\Pricing\Custom_Rate_Interval( 'extra-adult-rate', 15 * $extra_adults );
$room_rate->additional( $custom_rate );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment