WC_Emails::order_downloads( WC_Order $order, bool $sent_to_admin = false, bool $plain_text = false, string $email = '' )
Show order downloads in a table.
Description Description
Parameters Parameters
- $order
-
(Required) Order instance.
- $sent_to_admin
-
(Optional) If should sent to admin.
Default value: false
- $plain_text
-
(Optional) If is plain text email.
Default value: false
-
(Optional) Email address.
Default value: ''
Source Source
File: includes/class-wc-emails.php
public function order_downloads( $order, $sent_to_admin = false, $plain_text = false, $email = '' ) {
$show_downloads = $order->has_downloadable_item() && $order->is_download_permitted() && ! $sent_to_admin && ! is_a( $email, 'WC_Email_Customer_Refunded_Order' );
if ( ! $show_downloads ) {
return;
}
$downloads = $order->get_downloadable_items();
$columns = apply_filters(
'woocommerce_email_downloads_columns',
array(
'download-product' => __( 'Product', 'woocommerce' ),
'download-expires' => __( 'Expires', 'woocommerce' ),
'download-file' => __( 'Download', 'woocommerce' ),
)
);
if ( $plain_text ) {
wc_get_template(
'emails/plain/email-downloads.php',
array(
'order' => $order,
'sent_to_admin' => $sent_to_admin,
'plain_text' => $plain_text,
'email' => $email,
'downloads' => $downloads,
'columns' => $columns,
)
);
} else {
wc_get_template(
'emails/email-downloads.php',
array(
'order' => $order,
'sent_to_admin' => $sent_to_admin,
'plain_text' => $plain_text,
'email' => $email,
'downloads' => $downloads,
'columns' => $columns,
)
);
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |