add_action( 'woocommerce_checkout_order_processed', 'thrd_party_mails', 1, 1 ); function thrd_party_mails( $order_id ){ $order = new WC_Order( $order_id ); if (isset($order) && !empty($order)) { $items = $order->get_items(); $admin_email = get_option( 'admin_email' ); foreach ( $items as $item ) { $product_name = $item->get_name(); $product_id = $item->get_product_id(); $product_variation_id = $item->get_variation_id(); $is_3rd_party = get_field( "is_3rd_party", $product_id ); if (isset($is_3rd_party) && $is_3rd_party=='yes') { $th_party_email = get_field( "3rd_party_email", $product_id ); $is_th_party_mail_subject = get_field( "is_3rd_party_mail_subject", $product_id ); $th_party_content = get_field( "3rd_party_content", $product_id ); $th_party_bottom_content = get_field( "3rd_p...