Need help in custom script to fetch item list based on related custom field

Hello,

I would like to do some customization in the sales order item table as follows;

Item Group- Jersey Classic Club Short Sleeve For Men.

Below are the items which comes under the above mentioned item group;

J-M-CLASSIC CLUB-SS-XS
J-M-CLASSIC CLUB-SS-S
J-M-CLASSIC CLUB-SS-M
J-M-CLASSIC CLUB-SS-L
J-M-CLASSIC CLUB-SS-XL
J-M-CLASSIC CLUB-SS-2XL
J-M-CLASSIC CLUB-SS-3XL
J-M-CLASSIC CLUB-SS-4XL

Item Group- Jersey Classic Club Short Sleeve For Women.

Below are the items which comes under the above mentioned item group;

J-W-CLASSIC CLUB-SS-XS
J-W-CLASSIC CLUB-SS-S
J-W-CLASSIC CLUB-SS-M
J-W-CLASSIC CLUB-SS-L
J-W-CLASSIC CLUB-SS-XL
J-W-CLASSIC CLUB-SS-2XL
J-W-CLASSIC CLUB-SS-3XL
J-W-CLASSIC CLUB-SS-4XL

My idea is to create a custom field in the Sales Order Item table as Item Group.

So when I select Item Group as “Jersey Classic Club Short Sleeve For Men”, it should display only the related items to it in the Item Code field.

How can I achieve this. Can anyone help me with custom script?

Thanks & Regards,
Sujay

Why did you set the shirts styles up as Item Group and not use variants?