Variants by quantity with inventory tracking

Dear Community,

I am trying to achievethe following, if possible without the usage of external apps, for example by modifying the code of the Dawn theme:

In my shop I want to sell a product with two variants:

Variant 1: Size: Tray

Variant 2: Size: EPAL (= 30 Tray)

I want the inventory to flexibly react to the fact that 1 EPAL is equal to 30 Trays and to manage the inventory accordingly. Also I need the variants to have different prices (which I believe can be adjusted using the variant price).

For better understanding a quick example:

Lets assume a tray costs 10€ and an EPAL, which consists of 30 trays, costs 250€.

Lets also assume my inventoy of trays is 100.

A customer now buys 1 EPAL and 5 additional trays of th product. What I want is the inventory being adjusted to 65 Trays (EPAL = 30 Trays; 30 Trays + 5 additional Trays = 35 trays; Inevntory - 35 Trays = 65 trays). Also I want the total cart value to be 300€ (250€ for the EPAL and 50€ for the additional five trays).

Please tell me if this is somehow achievable. I would prefer to adjust th code but please also recommend some apps.

Thank you very much in advance!

Best regards!