Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('woocommerce_order_status_completed', function (int $orderId) {
- $order = wc_get_order($orderId);
- if ($order) {
- foreach ($order->get_items() as $item) {
- $isEvent = $item->meta_exists('_tbsa_eventId');
- if ($isEvent) {
- $eventPostId = $item->get_meta('_tbsa_eventId');
- $event = em_get_event($eventPostId, 'post_id');
- $location = $event ? $event->get_location() : null;
- $town = $location ? $location->location_town : null;
- if ($town) {
- // Teraz $town zawiera nazwę miasta
- }
- }
- }
- }
- }, 10, 1);
Advertisement
Add Comment
Please, Sign In to add comment