block
1 month ago
plain
1 month ago
admin-cancelled-order.php
1 year ago
admin-failed-order.php
9 months ago
admin-new-order.php
9 months ago
admin-payment-gateway-enabled.php
5 months ago
customer-abandoned-cart-recovery.php
1 month ago
customer-cancelled-order.php
9 months ago
customer-completed-order.php
9 months ago
customer-failed-order.php
9 months ago
customer-fulfillment-created.php
9 months ago
customer-fulfillment-deleted.php
9 months ago
customer-fulfillment-updated.php
4 months ago
customer-invoice.php
9 months ago
customer-new-account.php
2 months ago
customer-note.php
9 months ago
customer-on-hold-order.php
9 months ago
customer-pos-completed-order.php
9 months ago
customer-pos-refunded-order.php
9 months ago
customer-processing-order.php
9 months ago
customer-refunded-order.php
9 months ago
customer-reset-password.php
2 months ago
customer-review-request.php
3 months ago
customer-stock-notification-verified.php
2 months ago
customer-stock-notification-verify.php
1 year ago
customer-stock-notification.php
1 year ago
customer-verify-email.php
1 month ago
email-addresses.php
6 months ago
email-button.php
1 month ago
email-customer-details.php
1 year ago
email-downloads.php
9 months ago
email-footer.php
9 months ago
email-fulfillment-details.php
5 months ago
email-fulfillment-items.php
1 month ago
email-header.php
5 months ago
email-mobile-messaging.php
2 years ago
email-order-details.php
4 months ago
email-order-items.php
1 month ago
email-styles.php
1 month ago
email-fulfillment-items.php
185 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Email Fulfillment Items |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-fulfillment-items.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce\Templates\Emails |
| 15 | * @version 11.0.0 |
| 16 | */ |
| 17 | |
| 18 | use Automattic\WooCommerce\Utilities\FeaturesUtil; |
| 19 | |
| 20 | defined( 'ABSPATH' ) || exit; |
| 21 | |
| 22 | $margin_side = is_rtl() ? 'left' : 'right'; |
| 23 | |
| 24 | $price_text_align = 'right'; |
| 25 | |
| 26 | foreach ( $items as $item_id => $item ) : |
| 27 | $product = $item->item->get_product(); |
| 28 | $sku = ''; |
| 29 | $purchase_note = ''; |
| 30 | $image = ''; |
| 31 | |
| 32 | /** |
| 33 | * Email Order Item Visibility hook. |
| 34 | * |
| 35 | * This filter allows you to control the visibility of order items in emails. |
| 36 | * |
| 37 | * @param bool $visible Whether the item is visible in the email. |
| 38 | * @param WC_Order_Item_Product $item The order item object. |
| 39 | * @since 2.1.0 |
| 40 | */ |
| 41 | if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item->item ) ) { |
| 42 | continue; |
| 43 | } |
| 44 | |
| 45 | if ( is_object( $product ) ) { |
| 46 | $sku = $product->get_sku(); |
| 47 | $purchase_note = $product->get_purchase_note(); |
| 48 | $image = $product->get_image( $image_size ); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Email Order Item Thumbnail hook. |
| 53 | * |
| 54 | * @since 2.1.0 |
| 55 | */ |
| 56 | $order_item_class = apply_filters( 'woocommerce_order_item_class', 'order_item', $item->item, $order ); |
| 57 | ?> |
| 58 | <tr class="<?php echo esc_attr( $order_item_class ); ?>"> |
| 59 | <td class="td font-family text-align-left" style="vertical-align: middle; word-wrap:break-word;"> |
| 60 | <table class="order-item-data"> |
| 61 | <tr> |
| 62 | <?php |
| 63 | // Show title/image etc. |
| 64 | if ( $show_image ) { |
| 65 | $image_dimensions = wc_get_image_size( $image_size ); |
| 66 | $image_width = is_array( $image_dimensions ) && isset( $image_dimensions['width'] ) ? absint( $image_dimensions['width'] ) : 48; |
| 67 | $thumbnail_width = $image_width + 24; |
| 68 | |
| 69 | /** |
| 70 | * Email Order Item Thumbnail hook. |
| 71 | * |
| 72 | * @param string $image The image HTML. |
| 73 | * @param WC_Order_Item_Product $item The item being displayed. |
| 74 | * @since 2.1.0 |
| 75 | */ |
| 76 | echo '<td class="email-order-item-thumbnail" style="width: ' . esc_attr( $thumbnail_width ) . 'px;">' . wp_kses_post( apply_filters( 'woocommerce_order_item_thumbnail', $image, $item->item ) ) . '</td>'; |
| 77 | } |
| 78 | ?> |
| 79 | <td> |
| 80 | <?php |
| 81 | /** |
| 82 | * Order Item Name hook. |
| 83 | * |
| 84 | * @param string $item_name The item name HTML. |
| 85 | * @param WC_Order_Item_Product $item The item being displayed. |
| 86 | * @since 2.1.0 |
| 87 | */ |
| 88 | echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $item->item->get_name(), $item->item, false ) ); |
| 89 | |
| 90 | // SKU. |
| 91 | if ( $show_sku && $sku ) { |
| 92 | echo wp_kses_post( ' (#' . $sku . ')' ); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Allow other plugins to add additional product information. |
| 97 | * |
| 98 | * @param int $item_id The item ID. |
| 99 | * @param WC_Order_Item_Product $item The item object. |
| 100 | * @param WC_Order $order The order object. |
| 101 | * @param bool $plain_text Whether the email is plain text or not. |
| 102 | * @since 2.3.0 |
| 103 | */ |
| 104 | do_action( 'woocommerce_order_item_meta_start', $item_id, $item->item, $order, $plain_text ); |
| 105 | |
| 106 | $item_meta = wc_display_item_meta( |
| 107 | $item->item, |
| 108 | array( |
| 109 | 'before' => '', |
| 110 | 'after' => '', |
| 111 | 'separator' => '<br>', |
| 112 | 'echo' => false, |
| 113 | 'label_before' => '<span>', |
| 114 | 'label_after' => ':</span> ', |
| 115 | ) |
| 116 | ); |
| 117 | echo '<div class="email-order-item-meta">'; |
| 118 | // Using wp_kses instead of wp_kses_post to remove all block elements. |
| 119 | echo wp_kses( |
| 120 | $item_meta, |
| 121 | array( |
| 122 | 'br' => array(), |
| 123 | 'span' => array(), |
| 124 | 'a' => array( |
| 125 | 'href' => true, |
| 126 | 'target' => true, |
| 127 | 'rel' => true, |
| 128 | 'title' => true, |
| 129 | ), |
| 130 | ) |
| 131 | ); |
| 132 | echo '</div>'; |
| 133 | |
| 134 | /** |
| 135 | * Allow other plugins to add additional product information. |
| 136 | * |
| 137 | * @param int $item_id The item ID. |
| 138 | * @param WC_Order_Item_Product $item The item object. |
| 139 | * @param WC_Order $order The order object. |
| 140 | * @param bool $plain_text Whether the email is plain text or not. |
| 141 | * @since 2.3.0 |
| 142 | */ |
| 143 | do_action( 'woocommerce_order_item_meta_end', $item_id, $item->item, $order, $plain_text ); |
| 144 | |
| 145 | ?> |
| 146 | </td> |
| 147 | </tr> |
| 148 | </table> |
| 149 | </td> |
| 150 | <td class="td font-family text-align-<?php echo esc_attr( $price_text_align ); ?>" style="vertical-align:middle;"> |
| 151 | <?php |
| 152 | $qty = $item->qty; |
| 153 | $qty_display = esc_html( $qty ); |
| 154 | /** |
| 155 | * Email Order Item Quantity hook. |
| 156 | * |
| 157 | * @since 2.4.0 |
| 158 | */ |
| 159 | $quantity = apply_filters( 'woocommerce_email_order_item_quantity', $qty_display, $item->item ); |
| 160 | if ( '' !== $quantity ) { |
| 161 | echo '×' . wp_kses_post( $quantity ); |
| 162 | } |
| 163 | ?> |
| 164 | </td> |
| 165 | <td class="td font-family text-align-<?php echo esc_attr( $price_text_align ); ?>" style="vertical-align:middle;"> |
| 166 | <?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item->item ) ); ?> |
| 167 | </td> |
| 168 | </tr> |
| 169 | <?php |
| 170 | |
| 171 | if ( $show_purchase_note && $purchase_note ) { |
| 172 | ?> |
| 173 | <tr> |
| 174 | <td colspan="3" class="font-family text-align-left" style="vertical-align:middle;"> |
| 175 | <?php |
| 176 | echo wp_kses_post( wpautop( do_shortcode( $purchase_note ) ) ); |
| 177 | ?> |
| 178 | </td> |
| 179 | </tr> |
| 180 | <?php |
| 181 | } |
| 182 | ?> |
| 183 | |
| 184 | <?php endforeach; ?> |
| 185 |