Events Made Easy Forums How do I … Discount code in function of the birthdate

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #64538
    Anonymous
    Inactive

    Hy Franky,

    I d’like to have discount for my event and for the membership in function of the age of the people.
    I tried with de discount code like that but it dosen’t work.
    Could’you please help me?

    
    function my_eme_discount_function($Rabais_jeune_et_enfant) {
        $calculated_discount=0;
        $coupon= ""}
        // calculate your stuff based on the booking and answers arrays
        // and return the discount. A starting example:
        $answers=eme_get_booking_post_answers($booking);
        foreach ($answers as $answer) {
            if ($answer['field_name'] == "Date de naissance" {
                   $coupon = $answer['answer'];
    				$date1 = "01.01.2002"
            }
        }
        // now check $coupon for your wanted value and do the discount ($booking has all the booking info)
        if ($coupon <= $date1) {
                // return a total discount of -20
                $calculated_discount=$booking['event_price']-20;
        }
        return $calculated_discount;
    }
    add_filter('eme_discount_Rabais_jeune_et_enfant','my_eme_discount_function');
    

    Thanks a lot.

    #64541
    Franky
    Keymaster

    I haven’t checked your code in detail, but your function definition should be:

    
    function my_eme_discount_function($booking) {
    

    and not

    
    function my_eme_discount_function($Rabais_jeune_et_enfant) {
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top