Code Duplication    Length = 13-16 lines in 2 locations

includes/class-wc-ajax.php 2 locations

@@ 506-521 (lines=16) @@
503
	/**
504
	 * Get order details.
505
	 */
506
	public static function get_order_details() {
507
		check_admin_referer( 'woocommerce-preview-order', 'security' );
508
509
		if ( ! current_user_can( 'edit_shop_orders' ) ) {
510
			wp_die( -1 );
511
		}
512
513
		$order = wc_get_order( absint( $_GET['order_id'] ) ); // WPCS: sanitization ok.
514
515
		if ( $order ) {
516
			include_once 'admin/list-tables/class-wc-admin-list-table-orders.php';
517
518
			wp_send_json_success( WC_Admin_List_Table_Orders::order_preview_get_order_details( $order ) );
519
		}
520
		wp_die();
521
	}
522
523
	/**
524
	 * Add an attribute row.
@@ 1255-1267 (lines=13) @@
1252
	/**
1253
	 * Load order items via ajax.
1254
	 */
1255
	public static function load_order_items() {
1256
		check_ajax_referer( 'order-item', 'security' );
1257
1258
		if ( ! current_user_can( 'edit_shop_orders' ) ) {
1259
			wp_die( -1 );
1260
		}
1261
1262
		// Return HTML items
1263
		$order_id = absint( $_POST['order_id'] );
1264
		$order    = wc_get_order( $order_id );
1265
		include 'admin/meta-boxes/views/html-order-items.php';
1266
		wp_die();
1267
	}
1268
1269
	/**
1270
	 * Add order note via ajax.