Force Quantity Multiple for Variations in WooCommerce

$50.00

Demo Video

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 :

Installation

Copy and paste the PHP code to the end of your child themes functions.php file or custom code/snippets plugin.

Code Settings

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.

Reviews

Be the first to review “Force Quantity Multiple for Variations in WooCommerce”

Your email address will not be published. Required fields are marked *

These solutions may also help :