Woocommerce Order Quantity in Multiples for variable products

I have variable products (beers), each product can be sold in bottles, cans or kegs.

On cart and checkout pages I need to check whether total sum of bottles/cans in cart creates a multiple of 6. (e.g. 1 bottle of Beer01, 4 bottles of Beer02, 1 bottle of Beer03 => user is allowed to finish the order). Each bottle/can variation has a shipping class “bottle”, kegs have no shipping class.

Tried to use this solution to limit the cart items with a certain shipping class, but it works for simple products only, not for variable ones: https://stackoverflow.com/a/47219447/4214743

Could not find any solution, so I would really appreciate any help with this 🙂

Thanks in advance