This solution enables you to force customers to purchase specific product variations by any multiple you set in the code. In this example, product variation id 15463 for size large attribute for t shirts can only proceed to checkout if purchased by quantities of 5.
If the quantity matches the multiple set in your code, the customer can proceed to checkout, otherwise, they get this error message on the checkout page :
Copy and paste the PHP code to the end of your child themes functions.php file or custom code/snippets plugin.
Swap out your variation id on lines 12 and 30.
Get Variation Id
The id for each variation is shown next to the variation on the Edit Product > Product Data – Variable Product > Variations.