简体   繁体   中英

Woocommerce/Wordpress Email Multiple Attachments

I currently have two functions:

public function send_order_attach_itemone($attachments,$order_info) {
 // Code here
}
public function send_order_attach_itemtwo($attachments,$order_info) {
 // Code here
}

How can I attach both items? This is the call:

add_filter('send_order_email',array($this,'send_order_attach_itemone'),10,3);

I can get it to attach one or the other.

You can add as many filters as you want (This works with all WordPress filters).

add_filter('send_order_email',array($this,'send_order_attach_itemone'),10,3);
add_filter('send_order_email',array($this,'send_order_attach_itemtwo'),10,3);

Please note that the last parameter of add_filter ("3" in your code) is the number of arguments the callback function expects but your functions only accept 2 parameters ($attachments,$order_info) . So you should change either the filter call or the functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM