Set taxes per person in percentage

  • This topic has 6 replies, 3 voices, and was last updated 1 week ago by Christophe CONDUCHE.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1296593

    Hi,

    In my area tourist tax is 5% of the room rent/adult/day . How can I set this please ?
    I could have done a general 5% tax but children are not concerned by this tax.

    Regards,
    David

    #1297050

    In fact their formula is worst :

    $roomPrice / $adults * ($tax['amount']['adults']/100) + $roomPrice / $children * ($tax['amount']['children ']/100);

    It looks like I’ll need to hardcode this into the
    motopress-hotel-booking/includes/entities/reserved-room.php

    and replace the line 434.

    Please notify me if you add this natively into your code.
    Thanks.

    #1297169

    Hi David,

    Unfortunately, there is no possibility to add a percentage tax that should be applied to adults only. Also there is no option to override the function safely from updates so you might need to modify the files of the plugin directly.

    best regards,
    J. Davis

    #1777569

    Can you confirm us where it is now in the source code ?
    The files structer has changed a bit. I tried to modify it in the file taxesandfees.php in includes/taxandfees

    (www/wp/wp-content/plugins/motopress-hotel-booking/includes/taxes-and-fees)

    I need a formula of type :

    ($roomPrice / ($adults+ $children)) * ($tax[‘amount’][‘adults’]/100) * 1.44 * $adults

    I tried this :
    $feePrice = ($this->roomPrice / ($this->atts[‘adults_amount’] + $this->atts[‘children_amount’]))
    *( $fee[‘amount’][‘adults’]/100 ) * 1.44 * $this->atts[‘adults_amount’] ;

    I tried also to do the appropriate change to tax switch a few lines upper but it seems that the “Taxe de sejour (Accomodotaito n rate) is neithe a tax ort a fee of this function/file.

    Where can I look at to change it ?
    I tried to look in the suggested file motopress-hotel-booking/includes/entities/reserved-room.php but didn’t found the AccomadationTax calculation.

    Where it is ?

    #1777591
    
    
    private function calcTaxes() {
                    if ( ! empty( $this->taxes ) ) {
                            foreach ( $this->taxes as $tax ) {
                                    $taxPrice = 0;
    
                                    switch ( $tax['type'] ) {
                                            case 'per_guest_per_day':
                                                    $taxPrice = $this->atts['adults_amount'] * $tax['amount']['adults'] + $this->atts['children_amount'] * $tax['amount']['children'];
                                                    if ( $tax['limit'] == 0 ) {
                                                            $taxPrice *= $this->atts['period_nights'];
                                                    } else {
                                                            $taxPrice *= min( $tax['limit'], $this->atts['period_nights'] );
                                                    }
                                                    break;
    
                                            case 'per_room_per_day':
                                                    $taxPrice = $this->atts['accommodations_amount'] * $tax['amount'];
                                                    if ( $tax['limit'] == 0 ) {
                                                            $taxPrice *= $this->atts['period_nights'];
                                                    } else {
                                                            $taxPrice *= min( $tax['limit'], $this->atts['period_nights'] );
                                                    }
                                                    break;
    
                                            case 'per_room_percentage':
                                                    $taxPrice = $this->roomPrice / 100 * $tax['amount'];
                                                    break;
                                    }
                                    if ( $tax['included'] ) {
                                            $this->taxIncludedTotal += $taxPrice;
                                    } else {
                                            $this->taxExcludedTotal += $taxPrice;
                                    }
                            }
                    }
            }
    
    

    I tried to change the calculation to

    $taxPrice = ($this->roomPrice / ($this->atts[‘adults_amount’] + $this->atts[‘children_amount’]))
    *( $tax[‘amount’][‘adults’]/100 ) * 1.44 * $this->atts[‘adults_amount’] ;

    or

    $feePrice = ($this->roomPrice / ($this->atts[‘adults_amount’] + $this->atts[‘children_amount’]))
    *( $fee[‘amount’][‘adults’]/100 ) * 1.44 * $this->atts[‘adults_amount’] ;

    in both switch ccase ‘per_guest_per_day’:

    but without the expected effect

    #1778416

    Hi Christophe,
    Unfortunately, we do not provide customization services or consultation of this type, as all our developers are working on new plugins and theme updates. You can search for a third-party developer who can modify the plugin according to your needs.

    #1781632

    Humm, this is not a standalone request, this is mandatory in order to be able to calculate corectly the “Taxe de séjour” in France.

    without this function HB is not usable in France.

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