I am trying to disable quantity changes in the Woocommerce cart to every product except a single category.
I have tried a custom function to do this but it disables it for all items. Looking to only allow one category product quantity to be changed. I have used this code to disable it on all products so far:
add_filter( 'woocommerce_cart_item_quantity', 'wc_cart_item_quantity', 10, 3 );
function wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item
){
if( is_cart() ){
$product_quantity = sprintf( '%2$s <input type="hidden"
name="cart[%1$s][qty]" value="%2$s" />', $cart_item_key,
$cart_item['quantity'] );
}
return $product_quantity;
}