如何在此電子郵件的主題行中添加產(chǎn)品名稱。是否有電子郵件主題行可用過濾器的列表?我希望能夠做到這一點而不必編寫自定義php。我正在尋找做這樣的事情:已完成的訂單-[{{product_name}]({order_number})-{order_date}嘗試并添加了以下代碼,functions.php但未顯示主題:add_filter( 'woocommerce_email_subject_customer_completed_order', 'customer_completed_order_subject', 10, 2 ); function customer_completed_order_subject($string,$order){$fname = $order->billing_first_name;$lanme = $order->billing_last_name;$email = $order->billing_email;$items = $order->get_items();foreach($items as $meta_key => $items){ $product_name = $items['name']; $product_id = $items['product_id'];}$subject_line = get_field('email_subject',$product_id);$subject_line = str_replace('{product}',$product_name,$subject_line);$subject_line = str_replace('{biller_fname}',$fname,$subject_line);$subject_line = str_replace('{biller_lastname}',$lanme,$subject_line);$subject_line = str_replace('{biller_email}',$email,$subject_line);$subject_line = str_replace('{blog_name}',get_bloginfo('name'),$subject_line);return $subject_line;}
- 1 回答
- 0 關(guān)注
- 154 瀏覽
添加回答
舉報
0/150
提交
取消