Created
October 9, 2019 20:46
-
-
Save Ravenna/193fc9735b85cdafb741d000d4ec077d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("HTTP/1.1 200 OK"); // Forcing the 200 OK header as WP can return 404 otherwise | |
$orders = get_orders_ids_by_product_id(498); | |
$output = array(); | |
foreach($orders as $o){ | |
$order = wc_get_order( $o ); | |
$info = [ | |
'First Name' => $order->get_billing_first_name(), | |
'Last Name' => $order->get_billing_last_name(), | |
'Order Status' => $order->get_status(), | |
'Shipping Address 1' => $order->get_shipping_address_1(), | |
'Shipping Address 2' => $order->get_shipping_address_2(), | |
'Shipping City' => $order->get_shipping_city(), | |
'Shipping State' => $order->get_shipping_state(), | |
'Shipping Postcode' => $order->get_shipping_postcode(), | |
'Email' => get_post_meta($o, 'Email'), | |
'Day Phone' => get_post_meta($o, 'Day Phone'), | |
'Mobile Phone' => get_post_meta($o, 'Mobile Phone'), | |
'Order ID' => $o | |
]; | |
array_push($output, $info); | |
} | |
echo serialize($output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment