/** * Set an order quantity multiple for checkout */ add_action('woocommerce_checkout_process', 'cc_order_quantity_multiple'); add_action('woocommerce_before_cart', 'cc_order_quantity_multiple'); function cc_order_quantity_multiple() { // Set this variable to specify an order quantity multiple $multiple = 6; if ((WC()->cart->get_cart_contents_count() % $multiple) > 0) { if(is_cart()) { remove_action('woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20); wc_print_notice(sprintf('You must place an order with a multiple of 6 items'), 'error'); } else { remove_action('woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20); wc_add_notice(sprintf('You must place an order with a multiple of 6 items'), 'error'); } } }