Advertisement
Fany_VanDaal

Přidání přílohy do emailu

May 23rd, 2019
823
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // přidání dokumentů do emailu
  2. add_filter( 'woocommerce_email_attachments', 'attach_complaints_conditions_pdf_to_email', 10, 3);
  3.  
  4. function attach_complaints_conditions_pdf_to_email ( $attachments, $status , $order ) {
  5.  
  6. $allowed_statuses = array( 'new_order', 'customer_invoice', 'customer_processing_order', 'customer_completed_order' );
  7.  
  8. if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
  9. $dokument1 = get_template_directory() . '/oznameni-o-odstoupeni-od-smlouvy.pdf';
  10. $dokument2 = get_template_directory() . '/obchodni-podminky.pdf';
  11. $attachments = array($dokument1, $dokument2);
  12. }
  13. return $attachments;
  14. }
Advertisement
RAW Paste Data Copied
Advertisement