2014-07-17 20:17:54 +00:00
< ? php
2018-06-15 13:32:30 +00:00
/**
* Order items HTML for meta box .
*
* @ package WooCommerce / Admin
*/
2014-09-20 20:05:06 +00:00
2018-06-15 13:32:30 +00:00
defined ( 'ABSPATH' ) || exit ;
2014-07-19 04:08:02 +00:00
2014-08-12 11:54:41 +00:00
global $wpdb ;
2018-06-15 13:32:30 +00:00
$payment_gateway = wc_get_payment_gateway_by_order ( $order );
2014-09-01 15:35:04 +00:00
$line_items = $order -> get_items ( apply_filters ( 'woocommerce_admin_order_item_types' , 'line_item' ) );
2017-08-09 13:55:42 +00:00
$discounts = $order -> get_items ( 'discount' );
2014-09-01 15:35:04 +00:00
$line_items_fee = $order -> get_items ( 'fee' );
$line_items_shipping = $order -> get_items ( 'shipping' );
2014-07-28 16:08:11 +00:00
2014-11-18 16:45:29 +00:00
if ( wc_tax_enabled () ) {
2016-11-02 18:50:42 +00:00
$order_taxes = $order -> get_taxes ();
$tax_classes = WC_Tax :: get_tax_classes ();
$classes_options = wc_get_product_tax_class_options ();
2017-08-09 13:55:42 +00:00
$show_tax_columns = count ( $order_taxes ) === 1 ;
2014-07-28 16:08:11 +00:00
}
2014-07-17 20:17:54 +00:00
?>
2014-07-18 20:24:34 +00:00
< div class = " woocommerce_order_items_wrapper wc-order-items-editable " >
2014-07-17 20:17:54 +00:00
< table cellpadding = " 0 " cellspacing = " 0 " class = " woocommerce_order_items " >
2016-03-22 14:54:02 +00:00
< thead >
2014-07-17 20:17:54 +00:00
< tr >
2017-11-21 17:50:30 +00:00
< th class = " item sortable " colspan = " 2 " data - sort = " string-ins " >< ? php esc_html_e ( 'Item' , 'woocommerce' ); ?> </th>
2015-04-22 02:13:55 +00:00
< ? php do_action ( 'woocommerce_admin_order_item_headers' , $order ); ?>
2017-11-21 17:50:30 +00:00
< th class = " item_cost sortable " data - sort = " float " >< ? php esc_html_e ( 'Cost' , 'woocommerce' ); ?> </th>
< th class = " quantity sortable " data - sort = " int " >< ? php esc_html_e ( 'Qty' , 'woocommerce' ); ?> </th>
< th class = " line_cost sortable " data - sort = " float " >< ? php esc_html_e ( 'Total' , 'woocommerce' ); ?> </th>
2016-03-22 14:54:02 +00:00
< ? php
2018-03-05 18:59:17 +00:00
if ( ! empty ( $order_taxes ) ) :
foreach ( $order_taxes as $tax_id => $tax_item ) :
$tax_class = wc_get_tax_class_by_tax_id ( $tax_item [ 'rate_id' ] );
$tax_class_name = isset ( $classes_options [ $tax_class ] ) ? $classes_options [ $tax_class ] : __ ( 'Tax' , 'woocommerce' );
$column_label = ! empty ( $tax_item [ 'label' ] ) ? $tax_item [ 'label' ] : __ ( 'Tax' , 'woocommerce' );
/* translators: %1$s: tax item name %2$s: tax class name */
$column_tip = sprintf ( esc_html__ ( '%1$s (%2$s)' , 'woocommerce' ), $tax_item [ 'name' ], $tax_class_name );
?>
< th class = " line_tax tips " data - tip = " <?php echo esc_attr( $column_tip ); ?> " >
< ? php echo esc_attr ( $column_label ); ?>
< input type = " hidden " class = " order-tax-id " name = " order_taxes[<?php echo esc_attr( $tax_id ); ?>] " value = " <?php echo esc_attr( $tax_item['rate_id'] ); ?> " >
2019-06-07 13:06:03 +00:00
< ? php if ( $order -> is_editable () ) : ?>
< a class = " delete-order-tax " href = " # " data - rate_id = " <?php echo esc_attr( $tax_id ); ?> " ></ a >
< ? php endif ; ?>
2018-03-05 18:59:17 +00:00
</ th >
< ? php
endforeach ;
endif ;
2016-03-22 14:54:02 +00:00
?>
2014-07-17 20:17:54 +00:00
< th class = " wc-order-edit-line-item " width = " 1% " >& nbsp ; </ th >
</ tr >
</ thead >
2014-07-22 13:18:11 +00:00
< tbody id = " order_line_items " >
2018-03-05 18:59:17 +00:00
< ? php
2014-07-28 16:08:11 +00:00
foreach ( $line_items as $item_id => $item ) {
2016-08-08 14:22:00 +00:00
do_action ( 'woocommerce_before_order_item_' . $item -> get_type () . '_html' , $item_id , $item , $order );
2016-03-18 21:25:31 +00:00
2018-03-05 18:59:17 +00:00
include 'html-order-item.php' ;
2014-07-17 20:17:54 +00:00
2016-08-08 14:22:00 +00:00
do_action ( 'woocommerce_order_item_' . $item -> get_type () . '_html' , $item_id , $item , $order );
2014-07-22 13:18:11 +00:00
}
2016-08-05 14:56:23 +00:00
do_action ( 'woocommerce_admin_order_items_after_line_items' , $order -> get_id () );
2018-03-05 18:59:17 +00:00
?>
2014-07-22 13:18:11 +00:00
</ tbody >
2014-07-22 13:42:12 +00:00
< tbody id = " order_shipping_line_items " >
2018-03-05 18:59:17 +00:00
< ? php
2018-10-02 15:03:17 +00:00
$shipping_methods = WC () -> shipping () ? WC () -> shipping () -> load_shipping_methods () : array ();
2014-09-01 15:35:04 +00:00
foreach ( $line_items_shipping as $item_id => $item ) {
2018-03-05 18:59:17 +00:00
include 'html-order-shipping.php' ;
2014-07-22 13:18:11 +00:00
}
2016-08-05 14:56:23 +00:00
do_action ( 'woocommerce_admin_order_items_after_shipping' , $order -> get_id () );
2018-03-05 18:59:17 +00:00
?>
2014-07-22 13:18:11 +00:00
</ tbody >
2014-07-22 13:42:12 +00:00
< tbody id = " order_fee_line_items " >
2018-03-05 18:59:17 +00:00
< ? php
2014-09-01 15:35:04 +00:00
foreach ( $line_items_fee as $item_id => $item ) {
2018-03-05 18:59:17 +00:00
include 'html-order-fee.php' ;
2014-07-22 13:18:11 +00:00
}
2016-08-05 14:56:23 +00:00
do_action ( 'woocommerce_admin_order_items_after_fees' , $order -> get_id () );
2018-03-05 18:59:17 +00:00
?>
2014-07-22 13:18:11 +00:00
</ tbody >
< tbody id = " order_refunds " >
2018-03-05 18:59:17 +00:00
< ? php
2018-06-15 13:32:30 +00:00
$refunds = $order -> get_refunds ();
if ( $refunds ) {
2014-07-22 13:18:11 +00:00
foreach ( $refunds as $refund ) {
2018-03-05 18:59:17 +00:00
include 'html-order-refund.php' ;
2014-07-17 20:17:54 +00:00
}
2016-08-05 14:56:23 +00:00
do_action ( 'woocommerce_admin_order_items_after_refunds' , $order -> get_id () );
2014-07-22 13:18:11 +00:00
}
2018-03-05 18:59:17 +00:00
?>
2014-07-17 20:17:54 +00:00
</ tbody >
</ table >
</ div >
2014-07-18 20:24:34 +00:00
< div class = " wc-order-data-row wc-order-totals-items wc-order-items-editable " >
2014-07-23 10:47:02 +00:00
< ? php
2018-03-05 18:59:17 +00:00
$coupons = $order -> get_items ( 'coupon' );
if ( $coupons ) :
?>
< div class = " wc-used-coupons " >
< ul class = " wc_coupon_list " >
< li >< strong >< ? php esc_html_e ( 'Coupon(s)' , 'woocommerce' ); ?> </strong></li>
< ? php
foreach ( $coupons as $item_id => $item ) :
2019-02-22 13:33:41 +00:00
$post_id = $wpdb -> get_var ( $wpdb -> prepare ( " SELECT ID FROM { $wpdb -> posts } WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1; " , $item -> get_code () ) ); // phpcs:disable WordPress.WP.GlobalVariablesOverride.OverrideProhibited
2018-03-05 18:59:17 +00:00
$class = $order -> is_editable () ? 'code editable' : 'code' ;
?>
2018-06-15 13:32:30 +00:00
< li class = " <?php echo esc_attr( $class ); ?> " >
2018-03-05 18:59:17 +00:00
< ? php if ( $post_id ) : ?>
< ? php
2019-02-22 13:33:41 +00:00
$post_url = apply_filters (
'woocommerce_admin_order_item_coupon_url' ,
add_query_arg (
array (
'post' => $post_id ,
'action' => 'edit' ,
),
admin_url ( 'post.php' )
2018-03-05 18:59:17 +00:00
),
2019-02-22 13:33:41 +00:00
$item ,
$order
);
2018-03-05 18:59:17 +00:00
?>
< a href = " <?php echo esc_url( $post_url ); ?> " class = " tips " data - tip = " <?php echo esc_attr( wc_price( $item->get_discount (), array( 'currency' => $order->get_currency () ) ) ); ?> " >
< span >< ? php echo esc_html ( $item -> get_code () ); ?> </span>
</ a >
< ? php else : ?>
< span class = " tips " data - tip = " <?php echo esc_attr( wc_price( $item->get_discount (), array( 'currency' => $order->get_currency () ) ) ); ?> " >
< span >< ? php echo esc_html ( $item -> get_code () ); ?> </span>
</ span >
< ? php endif ; ?>
< ? php if ( $order -> is_editable () ) : ?>
< a class = " remove-coupon " href = " javascript:void(0) " aria - label = " Remove " data - code = " <?php echo esc_attr( $item->get_code () ); ?> " ></ a >
< ? php endif ; ?>
</ li >
< ? php endforeach ; ?>
</ ul >
</ div >
< ? php endif ; ?>
2014-07-17 21:17:42 +00:00
< table class = " wc-order-totals " >
2019-12-19 04:51:45 +00:00
< ? php ?>
< tr >
< td class = " label " >< ? php esc_html_e ( 'Item(s) Subtotal:' , 'woocommerce' ); ?> </td>
< td width = " 1% " ></ td >
< td class = " total " >
< ? php echo wc_price ( $order -> get_subtotal (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?>
</ td >
</ tr >
< ? php ?>
2017-10-13 13:01:20 +00:00
< ? php if ( 0 < $order -> get_total_discount () ) : ?>
< tr >
2019-12-19 04:51:45 +00:00
< td class = " label " >< ? php esc_html_e ( 'Coupon(s):' , 'woocommerce' ); ?> </td>
2017-10-13 13:01:20 +00:00
< td width = " 1% " ></ td >
< td class = " total " >
2018-06-15 13:32:30 +00:00
< ? php echo wc_price ( $order -> get_total_discount (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?>
2017-10-13 13:01:20 +00:00
</ td >
</ tr >
< ? php endif ; ?>
2019-12-19 04:51:45 +00:00
< ? php if ( 0 < $order -> get_fees () ) : ?>
< tr >
< td class = " label " >< ? php esc_html_e ( 'Fee(s):' , 'woocommerce' ); ?> </td>
< td width = " 1% " ></ td >
< td class = " total " >
< ? php echo wc_price ( $order -> get_fees (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?>
</ td >
</ tr >
< ? php endif ; ?>
2017-10-12 21:01:11 +00:00
2016-08-05 14:56:23 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_discount' , $order -> get_id () ); ?>
2017-10-12 21:01:11 +00:00
2017-10-13 13:01:20 +00:00
< ? php if ( $order -> get_shipping_methods () ) : ?>
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label " >< ? php esc_html_e ( 'Shipping:' , 'woocommerce' ); ?> </td>
2017-10-13 13:01:20 +00:00
< td width = " 1% " ></ td >
2017-11-21 17:50:30 +00:00
< td class = " total " >
< ? php
$refunded = $order -> get_total_shipping_refunded ();
if ( $refunded > 0 ) {
2019-02-22 13:33:41 +00:00
echo '<del>' . wp_strip_all_tags ( wc_price ( $order -> get_shipping_total (), array ( 'currency' => $order -> get_currency () ) ) ) . '</del> <ins>' . wc_price ( $order -> get_shipping_total () - $refunded , array ( 'currency' => $order -> get_currency () ) ) . '</ins>' ; // WPCS: XSS ok.
2017-10-13 13:01:20 +00:00
} else {
2018-06-15 13:32:30 +00:00
echo wc_price ( $order -> get_shipping_total (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok.
2017-10-13 13:01:20 +00:00
}
2019-02-22 13:33:41 +00:00
?>
2018-03-05 18:59:17 +00:00
</ td >
2017-10-13 13:01:20 +00:00
</ tr >
< ? php endif ; ?>
2017-10-12 21:01:11 +00:00
2016-08-05 14:56:23 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_shipping' , $order -> get_id () ); ?>
2014-08-29 01:56:30 +00:00
2014-11-18 16:45:29 +00:00
< ? php if ( wc_tax_enabled () ) : ?>
2019-02-22 13:33:41 +00:00
< ? php foreach ( $order -> get_tax_totals () as $code => $tax_total ) : ?>
2014-07-28 16:08:11 +00:00
< tr >
2019-02-22 13:33:41 +00:00
< td class = " label " >< ? php echo esc_html ( $tax_total -> label ); ?> :</td>
2016-03-22 14:54:02 +00:00
< td width = " 1% " ></ td >
2017-11-21 17:50:30 +00:00
< td class = " total " >
< ? php
2019-02-22 13:33:41 +00:00
$refunded = $order -> get_total_tax_refunded_by_rate_id ( $tax_total -> rate_id );
2017-11-21 17:50:30 +00:00
if ( $refunded > 0 ) {
2019-02-22 13:33:41 +00:00
echo '<del>' . wp_strip_all_tags ( $tax_total -> formatted_amount ) . '</del> <ins>' . wc_price ( WC_Tax :: round ( $tax_total -> amount , wc_get_price_decimals () ) - WC_Tax :: round ( $refunded , wc_get_price_decimals () ), array ( 'currency' => $order -> get_currency () ) ) . '</ins>' ; // WPCS: XSS ok.
2015-06-01 10:06:11 +00:00
} else {
2019-02-22 13:33:41 +00:00
echo wp_kses_post ( $tax_total -> formatted_amount );
2015-06-01 10:06:11 +00:00
}
2019-02-22 13:33:41 +00:00
?>
2017-11-21 17:50:30 +00:00
</ td >
2014-07-28 16:08:11 +00:00
</ tr >
< ? php endforeach ; ?>
2014-07-17 20:17:54 +00:00
< ? php endif ; ?>
2014-08-29 01:56:30 +00:00
2016-08-05 14:56:23 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_tax' , $order -> get_id () ); ?>
2014-08-29 01:56:30 +00:00
2014-07-17 21:17:42 +00:00
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label " >< ? php esc_html_e ( 'Total' , 'woocommerce' ); ?> :</td>
2017-04-18 18:44:42 +00:00
< td width = " 1% " ></ td >
2016-03-22 14:54:02 +00:00
< td class = " total " >
2018-06-15 13:32:30 +00:00
< ? php echo $order -> get_formatted_order_total (); // WPCS: XSS ok. ?>
2016-03-22 14:54:02 +00:00
</ td >
2014-07-17 21:17:42 +00:00
</ tr >
2014-08-29 01:56:30 +00:00
2016-08-05 14:56:23 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_total' , $order -> get_id () ); ?>
2014-08-29 01:56:30 +00:00
2016-08-22 12:04:57 +00:00
< ? php if ( $order -> get_total_refunded () ) : ?>
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label refunded-total " >< ? php esc_html_e ( 'Refunded' , 'woocommerce' ); ?> :</td>
2016-08-22 12:04:57 +00:00
< td width = " 1% " ></ td >
2018-06-15 13:32:30 +00:00
< td class = " total refunded-total " >-< ? php echo wc_price ( $order -> get_total_refunded (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?></td>
2016-08-22 12:04:57 +00:00
</ tr >
< ? php endif ; ?>
2014-08-29 01:56:30 +00:00
2016-08-05 14:56:23 +00:00
< ? php do_action ( 'woocommerce_admin_order_totals_after_refunded' , $order -> get_id () ); ?>
2014-08-29 01:56:30 +00:00
2014-07-17 21:17:42 +00:00
</ table >
< div class = " clear " ></ div >
2014-07-17 20:17:54 +00:00
</ div >
2016-03-22 17:13:39 +00:00
< div class = " wc-order-data-row wc-order-bulk-actions wc-order-data-row-toggle " >
2014-07-18 20:24:34 +00:00
< p class = " add-items " >
2014-09-03 09:09:04 +00:00
< ? php if ( $order -> is_editable () ) : ?>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button add-line-item " >< ? php esc_html_e ( 'Add item(s)' , 'woocommerce' ); ?> </button>
2017-12-18 04:21:08 +00:00
< ? php if ( wc_coupons_enabled () ) : ?>
< button type = " button " class = " button add-coupon " >< ? php esc_html_e ( 'Apply coupon' , 'woocommerce' ); ?> </button>
< ? php endif ; ?>
2014-09-18 10:32:25 +00:00
< ? php else : ?>
2017-11-21 17:50:30 +00:00
< span class = " description " >< ? php echo wc_help_tip ( __ ( 'To edit this order change the status back to "Pending"' , 'woocommerce' ) ); ?> <?php esc_html_e( 'This order is no longer editable.', 'woocommerce' ); ?></span>
2014-07-22 19:25:37 +00:00
< ? php endif ; ?>
2015-07-29 12:13:41 +00:00
< ? php if ( 0 < $order -> get_total () - $order -> get_total_refunded () || 0 < absint ( $order -> get_item_count () - $order -> get_item_count_refunded () ) ) : ?>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button refund-items " >< ? php esc_html_e ( 'Refund' , 'woocommerce' ); ?> </button>
2014-08-29 05:04:51 +00:00
< ? php endif ; ?>
2014-09-25 00:41:13 +00:00
< ? php
2018-06-15 13:32:30 +00:00
// Allow adding custom buttons.
2014-09-25 00:41:13 +00:00
do_action ( 'woocommerce_order_item_add_action_buttons' , $order );
?>
2014-09-03 09:09:04 +00:00
< ? php if ( $order -> is_editable () ) : ?>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button button-primary calculate-action " >< ? php esc_html_e ( 'Recalculate' , 'woocommerce' ); ?> </button>
2014-07-22 19:25:37 +00:00
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
</ p >
</ div >
2016-03-22 17:13:39 +00:00
< div class = " wc-order-data-row wc-order-add-item wc-order-data-row-toggle " style = " display:none; " >
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button add-order-item " >< ? php esc_html_e ( 'Add product(s)' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button add-order-fee " >< ? php esc_html_e ( 'Add fee' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button add-order-shipping " >< ? php esc_html_e ( 'Add shipping' , 'woocommerce' ); ?> </button>
2017-08-18 09:36:10 +00:00
< ? php if ( wc_tax_enabled () ) : ?>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button add-order-tax " >< ? php esc_html_e ( 'Add tax' , 'woocommerce' ); ?> </button>
2017-08-18 09:36:10 +00:00
< ? php endif ; ?>
2014-09-18 16:05:42 +00:00
< ? php
2018-06-15 13:32:30 +00:00
// Allow adding custom buttons.
2014-09-19 15:05:25 +00:00
do_action ( 'woocommerce_order_item_add_line_buttons' , $order );
2014-09-18 16:05:42 +00:00
?>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button cancel-action " >< ? php esc_html_e ( 'Cancel' , 'woocommerce' ); ?> </button>
< button type = " button " class = " button button-primary save-action " >< ? php esc_html_e ( 'Save' , 'woocommerce' ); ?> </button>
2014-07-17 20:17:54 +00:00
</ div >
2015-07-29 12:13:41 +00:00
< ? php if ( 0 < $order -> get_total () - $order -> get_total_refunded () || 0 < absint ( $order -> get_item_count () - $order -> get_item_count_refunded () ) ) : ?>
2016-03-22 17:13:39 +00:00
< div class = " wc-order-data-row wc-order-refund-items wc-order-data-row-toggle " style = " display: none; " >
2014-07-17 21:17:42 +00:00
< table class = " wc-order-totals " >
2017-06-09 08:36:44 +00:00
< ? php if ( 'yes' === get_option ( 'woocommerce_manage_stock' ) ) : ?>
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label " >< label for = " restock_refunded_items " >< ? php esc_html_e ( 'Restock refunded items' , 'woocommerce' ); ?> :</label></td>
2018-09-11 10:50:20 +00:00
< td class = " total " >< input type = " checkbox " id = " restock_refunded_items " name = " restock_refunded_items " < ? php checked ( apply_filters ( 'woocommerce_restock_refunded_items' , true ) ); ?> /></td>
2017-06-09 08:36:44 +00:00
</ tr >
< ? php endif ; ?>
2014-07-17 21:17:42 +00:00
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label " >< ? php esc_html_e ( 'Amount already refunded' , 'woocommerce' ); ?> :</td>
2018-06-15 13:32:30 +00:00
< td class = " total " >-< ? php echo wc_price ( $order -> get_total_refunded (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?></td>
2014-07-17 21:17:42 +00:00
</ tr >
< tr >
2017-11-21 17:50:30 +00:00
< td class = " label " >< ? php esc_html_e ( 'Total available to refund' , 'woocommerce' ); ?> :</td>
2018-06-15 13:32:30 +00:00
< td class = " total " >< ? php echo wc_price ( $order -> get_total () - $order -> get_total_refunded (), array ( 'currency' => $order -> get_currency () ) ); // WPCS: XSS ok. ?></td>
2014-07-17 21:17:42 +00:00
</ tr >
< tr >
2019-02-22 13:30:49 +00:00
< td class = " label " >
< label for = " refund_amount " >
< ? php echo wc_help_tip ( __ ( 'Refund the line items above. This will show the total amount to be refunded' , 'woocommerce' ) ); ?>
< ? php esc_html_e ( 'Refund amount' , 'woocommerce' ); ?> :
</ label >
</ td >
2014-07-17 21:17:42 +00:00
< td class = " total " >
2019-02-22 13:33:41 +00:00
< input type = " text " id = " refund_amount " name = " refund_amount " class = " wc_input_price "
< ? php
2019-02-22 13:30:49 +00:00
if ( wc_tax_enabled () ) {
// If taxes are enabled, using this refund amount can cause issues due to taxes not being refunded also.
// The refunds should be added to the line items, not the order as a whole.
echo 'readonly' ;
}
2019-02-22 13:33:41 +00:00
?>
/>
2014-07-17 21:17:42 +00:00
< div class = " clear " ></ div >
</ td >
</ tr >
< tr >
2019-02-22 13:30:49 +00:00
< td class = " label " >
< label for = " refund_reason " >
< ? php echo wc_help_tip ( __ ( 'Note: the refund reason will be visible by the customer.' , 'woocommerce' ) ); ?>
< ? php esc_html_e ( 'Reason for refund (optional):' , 'woocommerce' ); ?>
</ label >
</ td >
2014-07-17 21:17:42 +00:00
< td class = " total " >
2017-07-04 20:27:25 +00:00
< input type = " text " id = " refund_reason " name = " refund_reason " />
2014-07-17 21:17:42 +00:00
< div class = " clear " ></ div >
</ td >
</ tr >
</ table >
< div class = " clear " ></ div >
< div class = " refund-actions " >
2015-01-19 14:49:28 +00:00
< ? php
2018-04-03 16:09:09 +00:00
$refund_amount = '<span class="wc-order-refund-amount">' . wc_price ( 0 , array ( 'currency' => $order -> get_currency () ) ) . '</span>' ;
$gateway_name = false !== $payment_gateway ? ( ! empty ( $payment_gateway -> method_title ) ? $payment_gateway -> method_title : $payment_gateway -> get_title () ) : __ ( 'Payment gateway' , 'woocommerce' );
if ( false !== $payment_gateway && $payment_gateway -> can_refund_order ( $order ) ) {
/* translators: refund amount, gateway name */
echo '<button type="button" class="button button-primary do-api-refund">' . sprintf ( esc_html__ ( 'Refund %1$s via %2$s' , 'woocommerce' ), wp_kses_post ( $refund_amount ), esc_html ( $gateway_name ) ) . '</button>' ;
}
2015-01-19 14:49:28 +00:00
?>
2017-11-21 17:50:30 +00:00
< ? php /* translators: refund amount */ ?>
2018-06-15 13:32:30 +00:00
< button type = " button " class = " button button-primary do-manual-refund tips " data - tip = " <?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?> " >< ? php printf ( esc_html__ ( 'Refund %s manually' , 'woocommerce' ), wp_kses_post ( $refund_amount ) ); ?> </button>
2017-11-21 17:50:30 +00:00
< button type = " button " class = " button cancel-action " >< ? php esc_html_e ( 'Cancel' , 'woocommerce' ); ?> </button>
2017-09-28 15:17:13 +00:00
< input type = " hidden " id = " refunded_amount " name = " refunded_amount " value = " <?php echo esc_attr( $order->get_total_refunded () ); ?> " />
2014-07-17 21:17:42 +00:00
< div class = " clear " ></ div >
</ div >
2014-07-17 20:17:54 +00:00
</ div >
2014-08-29 05:04:51 +00:00
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
2015-08-06 04:37:53 +00:00
< script type = " text/template " id = " tmpl-wc-modal-add-products " >
2014-07-17 20:17:54 +00:00
< div class = " wc-backbone-modal " >
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
2015-01-02 13:58:57 +00:00
< header class = " wc-backbone-modal-header " >
2017-11-21 17:50:30 +00:00
< h1 >< ? php esc_html_e ( 'Add products' , 'woocommerce' ); ?> </h1>
2015-04-04 08:12:20 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
< span class = " screen-reader-text " > Close modal panel </ span >
</ button >
2014-07-17 20:17:54 +00:00
</ header >
< article >
2014-07-21 01:36:12 +00:00
< form action = " " method = " post " >
2018-06-08 11:19:14 +00:00
< table class = " widefat " >
< thead >
< tr >
< th >< ? php esc_html_e ( 'Product' , 'woocommerce' ); ?> </th>
< th >< ? php esc_html_e ( 'Quantity' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
< ? php
$row = '
2019-12-03 22:17:51 +00:00
< td >< select class = " wc-product-search " name = " item_id " data - allow_clear = " true " data - display_stock = " true " data - exclude_type = " variable " data - placeholder = " ' . esc_attr__( 'Search for a product…', 'woocommerce' ) . ' " ></ select ></ td >
2018-06-15 13:32:30 +00:00
< td >< input type = " number " step = " 1 " min = " 0 " max = " 9999 " autocomplete = " off " name = " item_qty " placeholder = " 1 " size = " 4 " class = " quantity " /></ td > ' ;
2018-06-08 11:19:14 +00:00
?>
< tbody data - row = " <?php echo esc_attr( $row ); ?> " >
< tr >
2018-06-15 13:32:30 +00:00
< ? php echo $row ; // WPCS: XSS ok. ?>
2018-06-08 11:19:14 +00:00
</ tr >
</ tbody >
</ table >
2014-07-21 01:36:12 +00:00
</ form >
</ article >
< footer >
< div class = " inner " >
2017-11-21 17:50:30 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php esc_html_e ( 'Add' , 'woocommerce' ); ?> </button>
2014-07-21 01:36:12 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
2015-04-04 08:06:10 +00:00
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
2014-07-21 01:36:12 +00:00
</ script >
2015-08-06 04:37:53 +00:00
< script type = " text/template " id = " tmpl-wc-modal-add-tax " >
2014-07-21 01:36:12 +00:00
< div class = " wc-backbone-modal " >
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
2015-01-02 13:58:57 +00:00
< header class = " wc-backbone-modal-header " >
2017-11-21 17:50:30 +00:00
< h1 >< ? php esc_html_e ( 'Add tax' , 'woocommerce' ); ?> </h1>
2015-04-04 08:12:20 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
< span class = " screen-reader-text " > Close modal panel </ span >
</ button >
2014-07-21 01:36:12 +00:00
</ header >
< article >
< form action = " " method = " post " >
2014-07-23 10:30:06 +00:00
< table class = " widefat " >
< thead >
< tr >
< th >& nbsp ; </ th >
2017-11-21 17:50:30 +00:00
< th >< ? php esc_html_e ( 'Rate name' , 'woocommerce' ); ?> </th>
< th >< ? php esc_html_e ( 'Tax class' , 'woocommerce' ); ?> </th>
< th >< ? php esc_html_e ( 'Rate code' , 'woocommerce' ); ?> </th>
< th >< ? php esc_html_e ( 'Rate %' , 'woocommerce' ); ?> </th>
2014-07-23 10:30:06 +00:00
</ tr >
</ thead >
2014-07-24 20:33:26 +00:00
< ? php
$rates = $wpdb -> get_results ( " SELECT * FROM { $wpdb -> prefix } woocommerce_tax_rates ORDER BY tax_rate_name LIMIT 100 " );
2014-07-21 01:36:12 +00:00
2018-03-05 18:59:17 +00:00
foreach ( $rates as $rate ) {
echo '
2014-07-23 10:30:06 +00:00
< tr >
< td >< input type = " radio " id = " add_order_tax_' . absint( $rate->tax_rate_id ) . ' " name = " add_order_tax " value = " ' . absint( $rate->tax_rate_id ) . ' " /></ td >
< td >< label for = " add_order_tax_' . absint( $rate->tax_rate_id ) . ' " > ' . WC_Tax::get_rate_label( $rate ) . ' </ label ></ td >
< td > ' . ( isset( $classes_options[ $rate->tax_rate_class ] ) ? $classes_options[ $rate->tax_rate_class ] : ' - ' ) . ' </ td >
< td > ' . WC_Tax::get_rate_code( $rate ) . ' </ td >
< td > ' . WC_Tax::get_rate_percent( $rate ) . ' </ td >
</ tr >
2018-06-15 13:32:30 +00:00
' ; // WPCS: XSS ok.
2018-03-05 18:59:17 +00:00
}
2014-07-23 10:30:06 +00:00
?>
</ table >
< ? php if ( absint ( $wpdb -> get_var ( " SELECT COUNT(tax_rate_id) FROM { $wpdb -> prefix } woocommerce_tax_rates; " ) ) > 100 ) : ?>
< p >
2017-11-21 17:50:30 +00:00
< label for = " manual_tax_rate_id " >< ? php esc_html_e ( 'Or, enter tax rate ID:' , 'woocommerce' ); ?> </label><br/>
2015-08-05 18:08:15 +00:00
< input type = " number " name = " manual_tax_rate_id " id = " manual_tax_rate_id " step = " 1 " placeholder = " <?php esc_attr_e( 'Optional', 'woocommerce' ); ?> " />
2014-07-23 10:30:06 +00:00
</ p >
< ? php endif ; ?>
2014-07-17 20:17:54 +00:00
</ form >
</ article >
< footer >
< div class = " inner " >
2017-11-21 17:50:30 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php esc_html_e ( 'Add' , 'woocommerce' ); ?> </button>
2014-07-17 20:17:54 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
2015-04-04 08:06:10 +00:00
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
2014-07-17 20:17:54 +00:00
</ script >