amelia_modify_payment_amount hook does not work

35 Views Asked by At

I’m trying to use the hook “” but it doesn’t change the price for me and I echo the first few tests to modify it based on the number of reservations and the other one as I test myself and why I’m not ordered to correctly call the properties of the reservations

function apply_discount_after_eight_bookings($price, $booking) {
    // Obtén el ID del cliente de la reserva
    $customerId = $booking->getCustomerId();

    // Calcula cuántas reservas ha realizado el cliente
    $reservationsCount = calculate_reservations_count($customerId);

    // Si el cliente tiene exactamente 8 reservas, aplica un descuento
    if ($reservationsCount === 8) {
        // Aplica un 50% de descuento
        $price *= 0.5;
    }

    return $price;
}

add_filter(‘amelia_modify_payment_amount’, ‘apply_discount_after_eight_bookings’, 10, 2);

This is the test and in the same way I don’t make any changes

function custom_discount_on_eight_bookings( $price, $booking ) {
$price = $price * 0.5;
    return $price;
}

add_filter( ‘amelia_modify_payment_amount’, ‘custom_discount_on_eight_bookings’, 10, 2 );

your text enter image description here

I raised a ticket on the official site but I have not received a response and I have tried to find information about this hook but I can only find the official documentation, which in my opinion is somewhat limited and I have tried several times with the hook but it has not worked for me.

0

There are 0 best solutions below