Skip to content

Instantly share code, notes, and snippets.

@kbxian
Created April 7, 2017 23:31
Show Gist options
  • Save kbxian/9ddcb26c8d42d47de93d7950a075d11b to your computer and use it in GitHub Desktop.
Save kbxian/9ddcb26c8d42d47de93d7950a075d11b to your computer and use it in GitHub Desktop.
$order = new WC_Order( $order_id );
$order_meta = get_post_meta($order_id);
$vendors = array();
$items = $order->get_items();
foreach ($items as $item) {
$prodid = $item['product_id'];
$vends = get_the_terms($prodid, 'dc_vendor_shop');
foreach ($vends as $vend) {
if (!in_array($vend, $vendors)) {
array_push($vendors, $vend);
}
}
}
$vids = array();
foreach ($vendors as $vend) {
$terms = get_terms( 'dc_vendor_shop', array(
'term_id' => $vend,
) );
foreach ($terms as $term) {
$vdetails = get_user_by('slug', $term->slug);
$vid = $vdetails->ID;
if (!in_array($vid, $vids)) {
array_push($vids, $vid);
}
}
}
// Send order details to seller
$buyer_firstname = $order->billing_first_name;
$buyer_lastname = $order->billing_last_name;
$buyer_email = $order->billing_email;
$buyer_phone = $order->billing_phone;
$ordertotal = $order->order_total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment