Update remove item notice based on order status
This commit is contained in:
parent
a1bd9ab2ae
commit
f633d9a0eb
|
@ -32,7 +32,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
global $wp_scripts;
|
||||
|
||||
$screen = get_current_screen();
|
||||
$screen_id = $screen ? $screen->id: '';
|
||||
$screen_id = $screen ? $screen->id : '';
|
||||
|
||||
// Register admin styles.
|
||||
wp_register_style( 'woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION );
|
||||
|
@ -268,18 +268,23 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
|||
wp_enqueue_script( 'wc-admin-coupon-meta-boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes-coupon' . $suffix . '.js', array( 'wc-admin-meta-boxes' ), WC_VERSION );
|
||||
}
|
||||
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 = '';
|
||||
$post_id = isset( $post->ID ) ? $post->ID : '';
|
||||
$currency = '';
|
||||
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
|
||||
|
||||
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
|
||||
$order = wc_get_order( $post_id );
|
||||
if ( $order ) {
|
||||
$currency = $order->get_currency();
|
||||
$currency = $order->get_currency();
|
||||
|
||||
if ( ! $order->has_status( array( 'pending', 'failed', 'cancelled' ) ) ) {
|
||||
$remove_item_notice = $remove_item_notice . ' ' . __( "You may need to manually restore the item's stock.", 'woocommerce' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'remove_item_notice' => __( "Are you sure you want to remove the selected items? If you have previously reduced this item's stock, or this order was submitted by a customer, you will need to manually restore the item's stock.", 'woocommerce' ),
|
||||
'remove_item_notice' => $remove_item_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' ),
|
||||
|
|
Loading…
Reference in New Issue