Merge pull request #30650 from woocommerce/fix/29890

Add individual item remove notices for shipping and fees closes #29890
This commit is contained in:
Néstor Soriano 2021-09-15 17:05:52 +02:00 committed by GitHub
commit 69203f2924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -653,7 +653,17 @@ jQuery( function ( $ ) {
},
delete_item: function() {
var answer = window.confirm( woocommerce_admin_meta_boxes.remove_item_notice );
var notice = woocommerce_admin_meta_boxes.remove_item_notice;
if ( $( this ).parents( 'tbody#order_fee_line_items' ).length ) {
notice = woocommerce_admin_meta_boxes.remove_fee_notice;
}
if ( $( this ).parents( 'tbody#order_shipping_line_items' ).length ) {
notice = woocommerce_admin_meta_boxes.remove_shipping_notice;
}
var answer = window.confirm( notice );
if ( answer ) {
var $item = $( this ).closest( 'tr.item, tr.fee, tr.shipping' );

View File

@ -305,9 +305,11 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
);
}
if ( in_array( str_replace( 'edit-', '', $screen_id ), array_merge( array( 'shop_coupon', 'product' ), wc_get_order_types( 'order-meta-boxes' ) ) ) ) {
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
$remove_fee_notice = __( 'Are you sure you want to remove the selected fees?', 'woocommerce' );
$remove_shipping_notice = __( 'Are you sure you want to remove the selected shipping?', 'woocommerce' );
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
$order = wc_get_order( $post_id );
@ -322,6 +324,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
$params = array(
'remove_item_notice' => $remove_item_notice,
'remove_fee_notice' => $remove_fee_notice,
'remove_shipping_notice' => $remove_shipping_notice,
'i18n_select_items' => __( 'Please select some items.', 'woocommerce' ),
'i18n_do_refund' => __( 'Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce' ),
'i18n_delete_refund' => __( 'Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce' ),