Code Duplication    Length = 13-14 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 1431-1443 (lines=13) @@
1428
	/**
1429
	 * Load order items via ajax.
1430
	 */
1431
	public static function load_order_items() {
1432
		check_ajax_referer( 'order-item', 'security' );
1433
1434
		if ( ! current_user_can( 'edit_shop_orders' ) || ! isset( $_POST['order_id'] ) ) {
1435
			wp_die( -1 );
1436
		}
1437
1438
		// Return HTML items.
1439
		$order_id = absint( $_POST['order_id'] );
1440
		$order    = wc_get_order( $order_id );
1441
		include 'admin/meta-boxes/views/html-order-items.php';
1442
		wp_die();
1443
	}
1444
1445
	/**
1446
	 * Add order note via ajax.
@@ 1498-1511 (lines=14) @@
1495
	/**
1496
	 * Delete order note via ajax.
1497
	 */
1498
	public static function delete_order_note() {
1499
		check_ajax_referer( 'delete-order-note', 'security' );
1500
1501
		if ( ! current_user_can( 'edit_shop_orders' ) || ! isset( $_POST['note_id'] ) ) {
1502
			wp_die( -1 );
1503
		}
1504
1505
		$note_id = (int) $_POST['note_id'];
1506
1507
		if ( $note_id > 0 ) {
1508
			wc_delete_order_note( $note_id );
1509
		}
1510
		wp_die();
1511
	}
1512
1513
	/**
1514
	 * Search for products and echo json.