Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $wpdb;
- $order = new WC_Order( $order_id );
- foreach($order->get_items() as $items => $item) {
- // get the replacement email
- $results = $wpdb->get_results("SELECT product_id, replacement_email FROM {$wpdb->prefix}fulfilment_center_by_product where product_id={$item['product_id']}");
- if($results) { foreach($results as $result) { $rep_prodid = $result->product_id; $rep_email = $result->replacement_email;
- if($rep_prodid == $item['product_id']) { $this->send( $rep_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); }else { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } } } }
Add Comment
Please, Sign In to add comment