SHOW:
|
|
- or go back to the newest paste.
1 | function my_em_add_fee($paypal_vars, $EM_Booking, $EM_Gateway_Paypal){ | |
2 | - | $amount = 30; |
2 | + | $prix = $EM_Booking->get_price_pre_taxes(); |
3 | - | if ( !empty($amount) ){ |
3 | + | $pourcentage = 5; |
4 | - | $itemcount = (count($EM_Booking->get_tickets_bookings()->tickets_bookings) + 1); |
4 | + | $amount = $prix - ($prix * ($pourcentage/100)); |
5 | - | $paypal_vars['item_name_'.$itemcount] = wp_kses_data("Paypal Fee"); |
5 | + | if ( !empty($amount) ){ |
6 | - | $paypal_vars['quantity_'.$itemcount] = 1; |
6 | + | $itemcount = (count($EM_Booking->get_tickets_bookings()->tickets_bookings) + 1); |
7 | - | $paypal_vars['amount_'.$itemcount] = $amount; |
7 | + | $paypal_vars['item_name_'.$itemcount] = wp_kses_data("Frais paypal"); |
8 | - | } |
8 | + | $paypal_vars['quantity_'.$itemcount] = 1; |
9 | - | return $paypal_vars; |
9 | + | $paypal_vars['amount_'.$itemcount] = $amount; |
10 | } | |
11 | return $paypal_vars; | |
12 | } | |
13 | add_filter('em_gateway_paypal_get_paypal_vars','my_em_add_fee',1,3); |