Advertisement
eventsmanager

Adding charges to gateways

Nov 16th, 2023 (edited)
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. function my_em_price_adjustments_2( $EM_Event, $EM_Booking, $post_validation ){
  5. if( $post_validation ){
  6. $EM_Booking->booking_meta['surcharges'] = array();
  7. $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings();
  8. $label = "Charges";
  9.  
  10. $amount = 0;
  11. foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){
  12.  
  13. $amount += ($EM_Ticket_Booking->get_ticket()->ticket_price * .2);
  14.  
  15. }
  16. if ( $amount > 0 ){
  17. $EM_Booking->booking_meta['surcharges'][] = array(
  18. 'name' => $label,
  19. 'type' => '#',
  20. 'amount' => $amount,
  21. 'tax' => 'pre'
  22. );
  23. }
  24. }
  25. }
  26. add_action('em_booking_add', 'my_em_price_adjustments_2', 100, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement