wc_get_email_order_items

Get HTML for the order items to be shown in emails.

Description

wc_get_email_order_items( (WC_Order) $order, (array) $args = array() ); 

Parameters (2)

0. $order (WC_Order)
The order.
1. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'wc_get_email_order_items' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
  3.  
  4. // The order. 
  5. $order = null; 
  6.  
  7. // The args. 
  8. $args = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_get_email_order_items($order, $args); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-template-functions.php  
  1. function wc_get_email_order_items( $order, $args = array() ) { 
  2. ob_start(); 
  3.  
  4. $defaults = array( 
  5. 'show_sku' => false,  
  6. 'show_image' => false,  
  7. 'image_size' => array( 32, 32 ),  
  8. 'plain_text' => false,  
  9. 'sent_to_admin' => false,  
  10. ); 
  11.  
  12. $args = wp_parse_args( $args, $defaults ); 
  13. $template = $args['plain_text'] ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php'; 
  14.  
  15. wc_get_template( $template, apply_filters( 'woocommerce_email_order_items_args', array( 
  16. 'order' => $order,  
  17. 'items' => $order->get_items(),  
  18. 'show_download_links' => $order->is_download_permitted() && ! $args['sent_to_admin'],  
  19. 'show_sku' => $args['show_sku'],  
  20. 'show_purchase_note' => $order->is_paid() && ! $args['sent_to_admin'],  
  21. 'show_image' => $args['show_image'],  
  22. 'image_size' => $args['image_size'],  
  23. 'plain_text' => $args['plain_text'],  
  24. 'sent_to_admin' => $args['sent_to_admin'],  
  25. ) ) ); 
  26.  
  27. return apply_filters( 'woocommerce_email_order_items_table', ob_get_clean(), $order );