Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'sliced_invoice_line_items_output', 'sliced_display_woocommerce_line_items_20180213', 9, 1 );
- function sliced_display_woocommerce_line_items_20180213( $output ) {
- $order = sliced_woocommerce_get_order();
- if( ! isset( $order ) || $order == false || empty( $order ) )
- return $output;
- $output = null;
- $output = '<table class="table table-sm table-bordered table-striped">
- <thead>
- <tr>
- <th class="qty"><strong>' . __( "Hrs/Qty", "sliced-invoices" ) . '</strong></th>
- <th class="service"><strong>' . __( "Service", "sliced-invoices" ) . '</strong></th>
- <th class="sku"><strong>' . __( "SKU", "sliced-invoices" ) . '</strong></th>
- <th class="rate"><strong>' . __( "Rate/Price", "sliced-invoices" ) . '</strong></th>';
- $output .= '<th class="total"><strong>' . __( "Sub Total", "sliced-invoices" ) . '</strong></th>
- </tr>
- </thead>
- <tbody>';
- foreach( $order->get_items() as $item_id => $item ) {
- $class = ($count % 2 == 0) ? "even" : "odd";
- $product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
- $purchase_note = get_post_meta( $product->get_id(), '_purchase_note', true );
- $is_visible = $product && $product->is_visible();
- $output .= '<tr class="row_' . esc_attr( $class ) . ' sliced-item">';
- $output .= '<td class="qty">' . apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '%s', wp_kses_post( $item['qty'] ) ) . '</strong>', $item ) . '</td>';
- $output .= '<td class="service">' . apply_filters( 'woocommerce_order_item_name', $is_visible ? sprintf( '<a href="%s">%s</a>', get_permalink( $item['product_id'] ), $item['name'] ) : $item['name'], $item, $is_visible ) . '</td>';
- $output .= '<td class="sku">' . $product->get_sku() . '</td>';
- $output .= '<td class="rate">' . wp_kses_post( wc_price( $order->get_item_subtotal( $item ) ) ) . '</td>';
- $output .= '<td class="total">' . wp_kses_post( $order->get_formatted_line_subtotal( $item ) ) . '</td>';
- $output .= '</tr>';
- $count++;
- }
- $output .= '</tbody></table>';
- return $output;
- }
Add Comment
Please, Sign In to add comment