Set item quantity to multiples of “x” for products in a specific category in Woocommerce
问题 I found online a snippet that allows you to set in the cart a minimum purchase to multiple quantities of “6”. Here it is: add_action( ‘woocommerce_check_cart_items’, ‘woocommerce_check_cart_quantities’ ); function woocommerce_check_cart_quantities() { $multiples = 6; $total_products = 0; foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $total_products += $values['quantity']; } if ( ( $total_products % $multiples ) > 0 ) wc_add_notice( sprintf( __('You need to buy in