Advertisement
Guest User

Untitled

a guest
Mar 26th, 2021
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.39 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Order Item Details
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/order/order-details-item.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://docs.woocommerce.com/document/template-structure/
  14.  * @package WooCommerce\Templates
  15.  * @version 3.7.0
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit;
  20. }
  21.  
  22. if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
  23.     return;
  24. }
  25. ?>
  26. <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'woocommerce-table__line-item order_item', $item, $order ) ); ?>">
  27.  
  28.     <td class="woocommerce-table__product-name product-name">
  29.         <?php
  30.         $is_visible        = $product && $product->is_visible();
  31.         $product_permalink = apply_filters( 'woocommerce_order_item_permalink', $is_visible ? $product->get_permalink( $item ) : '', $item, $order );
  32.  
  33.         echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item->get_name() ) : $item->get_name(), $item, $is_visible ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  34.         $qty          = $item->get_quantity();
  35.         $refunded_qty = $order->get_qty_refunded_for_item( $item_id );
  36.  
  37. $per_unit_or_square = get_field('pricem2_or_priceunit_', $product->get_id());
  38. if (!empty($per_unit_or_square)) {
  39. if ($per_unit_or_square == 'unit') {
  40.     $pricingtype_order_received = '<span class="pricingtype_order_received">'.__('&nbsp;unit&nbsp;', 'mbb').'</span>';
  41. } elseif ($per_unit_or_square == 'm2') {
  42.     $pricingtype_order_received = '<span class="pricingtype_order_received">'.__('&nbsp;m<sup>2</sup>&nbsp;', 'mbb').'</span>';
  43. } else {
  44.     $pricingtype_order_received = '<span class="pricingtype_order_received">'.__('&nbsp;pcs&nbsp;', 'mbb').'</span>';
  45. }
  46. }
  47.        
  48.        
  49.         if ( $refunded_qty ) {
  50.             $qty_display = '<del>' . esc_html( $qty ) . '</del> <ins>' . esc_html( $qty - ( $refunded_qty * -1 ) ) . '</ins>'.$pricingtype_order_received;
  51.         } else {
  52.             $qty_display = esc_html( $qty ).$pricingtype_order_received;
  53.         }
  54.        
  55.         echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times;&nbsp;%s', $qty_display ) . '</strong>', $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  56.  
  57.         do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order, false );
  58.  
  59.         wc_display_item_meta( $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  60.  
  61.         do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, false );
  62.         ?>
  63.     </td>
  64.  
  65.     <td class="woocommerce-table__product-total product-total">
  66.         <?php echo $order->get_formatted_line_subtotal( $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  67.     </td>
  68.  
  69. </tr>
  70.  
  71. <?php if ( $show_purchase_note && $purchase_note ) : ?>
  72.  
  73. <tr class="woocommerce-table__product-purchase-note product-purchase-note">
  74.  
  75.     <td colspan="2"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
  76.  
  77. </tr>
  78.  
  79. <?php endif; ?>
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement