Wix Cart API (Question regarding discouting)

Hi Wix Community,
I am hoping you’ll be able to help me out here.
I have rage registrations as a product: 5K and 10K
Now. I had made a variant of each type of shirt ie:
(unisex,female,youth, none)
(XS,S,M,L,XL)

And 5K and 10K were separate products. However, my problem now is, how can I keep track on inventory of the shirts when the 5k and 10k have their own apparent shirt inventory this way.

Is there a way that I can just create a Shirt Item such that, for ever race registration in cart, a shirt is free. Essentially a shirt comes with every registration.

This would allow me to only track one shirt inventory, but how can I make the cart only discount the amount of shirts for the amount of registrations being purchased using WIX CODE.

Thank you for your time
-Logan Eldridge.