/includes/admin/meta-boxes/views/html-order-shipping.php

  1. <?php 
  2. /** 
  3. * Shows a shipping line 
  4. * 
  5. * @var object $item The item being displayed 
  6. * @var int $item_id The id of the item being displayed 
  7. */ 
  8. if ( ! defined( 'ABSPATH' ) ) { 
  9. exit; 
  10. ?> 
  11. <tr class="shipping <?php echo ( ! empty( $class ) ) ? $class : ''; ?>" data-order_item_id="<?php echo esc_attr( $item_id ); ?>"> 
  12. <td class="thumb"><div></div></td> 
  13.  
  14. <td class="name"> 
  15. <div class="view"> 
  16. <?php echo esc_html( $item->get_name() ? $item->get_name() : __( 'Shipping', 'woocommerce' ) ); ?> 
  17. </div> 
  18. <div class="edit" style="display: none;"> 
  19. <input type="hidden" name="shipping_method_id[]" value="<?php echo esc_attr( $item_id ); ?>" /> 
  20. <input type="text" class="shipping_method_name" placeholder="<?php esc_attr_e( 'Shipping name', 'woocommerce' ); ?>" name="shipping_method_title[<?php echo esc_attr( $item_id ); ?>]" value="<?php echo esc_attr( $item->get_name() ); ?>" /> 
  21. <select class="shipping_method" name="shipping_method[<?php echo esc_attr( $item_id ); ?>]"> 
  22. <optgroup label="<?php esc_attr_e( 'Shipping method', 'woocommerce' ); ?>"> 
  23. <option value=""><?php _e( 'N/A', 'woocommerce' ); ?></option> 
  24. <?php 
  25. $found_method = false; 
  26.  
  27. foreach ( $shipping_methods as $method ) { 
  28. $current_method = ( 0 === strpos( $item->get_method_id(), $method->id ) ) ? $item->get_method_id() : $method->id; 
  29.  
  30. echo '<option value="' . esc_attr( $current_method ) . '" ' . selected( $item->get_method_id() === $current_method, true, false ) . '>' . esc_html( $method->get_method_title() ) . '</option>'; 
  31.  
  32. if ( $item->get_method_id() === $current_method ) { 
  33. $found_method = true; 
  34.  
  35. if ( ! $found_method && $item->get_method_id() ) { 
  36. echo '<option value="' . esc_attr( $item->get_method_id() ) . '" selected="selected">' . __( 'Other', 'woocommerce' ) . '</option>'; 
  37. } else { 
  38. echo '<option value="other">' . __( 'Other', 'woocommerce' ) . '</option>'; 
  39. ?> 
  40. </optgroup> 
  41. </select> 
  42. </div> 
  43.  
  44. <?php do_action( 'woocommerce_before_order_itemmeta', $item_id, $item, null ) ?> 
  45. <?php include( 'html-order-item-meta.php' ); ?> 
  46. <?php do_action( 'woocommerce_after_order_itemmeta', $item_id, $item, null ) ?> 
  47. </td> 
  48.  
  49. <?php do_action( 'woocommerce_admin_order_item_values', null, $item, absint( $item_id ) ); ?> 
  50.  
  51. <td class="item_cost" width="1%"> </td> 
  52. <td class="quantity" width="1%"> </td> 
  53.  
  54. <td class="line_cost" width="1%"> 
  55. <div class="view"> 
  56. <?php 
  57. echo wc_price( $item->get_total(), array( 'currency' => $order->get_currency() ) ); 
  58.  
  59. if ( $refunded = $order->get_total_refunded_for_item( $item_id, 'shipping' ) ) { 
  60. echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; 
  61. ?> 
  62. </div> 
  63. <div class="edit" style="display: none;"> 
  64. <input type="text" name="shipping_cost[<?php echo esc_attr( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo esc_attr( wc_format_localized_price( $item->get_total() ) ); ?>" class="line_total wc_input_price" /> 
  65. </div> 
  66. <div class="refund" style="display: none;"> 
  67. <input type="text" name="refund_line_total[<?php echo absint( $item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" class="refund_line_total wc_input_price" /> 
  68. </div> 
  69. </td> 
  70.  
  71. <?php 
  72. if ( ( $tax_data = $item->get_taxes() ) && wc_tax_enabled() ) { 
  73. foreach ( $order_taxes as $tax_item ) { 
  74. $tax_item_id = $tax_item->get_rate_id(); 
  75. $tax_item_total = isset( $tax_data['total'][ $tax_item_id ] ) ? $tax_data['total'][ $tax_item_id ] : ''; 
  76. ?> 
  77. <td class="line_tax" width="1%"> 
  78. <div class="view"> 
  79. <?php 
  80. echo ( '' !== $tax_item_total ) ? wc_price( wc_round_tax_total( $tax_item_total ), array( 'currency' => $order->get_currency() ) ) : '–'; 
  81.  
  82. if ( $refunded = $order->get_tax_refunded_for_item( $item_id, $tax_item_id, 'shipping' ) ) { 
  83. echo '<small class="refunded">-' . wc_price( $refunded, array( 'currency' => $order->get_currency() ) ) . '</small>'; 
  84. ?> 
  85. </div> 
  86. <div class="edit" style="display: none;"> 
  87. <input type="text" name="shipping_taxes[<?php echo absint( $item_id ); ?>][<?php echo esc_attr( $tax_item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $tax_item_total ) ) ? esc_attr( wc_format_localized_price( $tax_item_total ) ) : ''; ?>" class="line_tax wc_input_price" /> 
  88. </div> 
  89. <div class="refund" style="display: none;"> 
  90. <input type="text" name="refund_line_tax[<?php echo absint( $item_id ); ?>][<?php echo esc_attr( $tax_item_id ); ?>]" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" class="refund_line_tax wc_input_price" data-tax_id="<?php echo esc_attr( $tax_item_id ); ?>" /> 
  91. </div> 
  92. </td> 
  93. <?php 
  94. ?> 
  95. <td class="wc-order-edit-line-item"> 
  96. <?php if ( $order->is_editable() ) : ?> 
  97. <div class="wc-order-edit-line-item-actions"> 
  98. <a class="edit-order-item" href="#"></a><a class="delete-order-item" href="#"></a> 
  99. </div> 
  100. <?php endif; ?> 
  101. </td> 
  102. </tr> 
.