• Resolved Francisco Orta

    (@franpak2000)


    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 );

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘amelia_modify_payment_amount hook does not work’ is closed to new replies.