amelia_modify_payment_amount hook does not work

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer