I’m using combo offer woocommerce plugin to make a bundle product with specific item number of linked products
and I’d unchecked this option:
“Buyer can change the quantity of combo products?”
so when I head to the product page I see really that I can’t modify the items quantities
but when I add the product to cart then view cart it shows the quantities of included items of the combo product are able to be changed
enter image description here
how to prevent that please ?
I’ve added this code to my activated plugin :
add_filter('woocommerce_cart_item_quantity', 'disable_quantity_change_for_combo_products', 10, 3);
function disable_quantity_change_for_combo_products($product_quantity, $cart_item_key, $cart_item) {
// Check if the product type is 'wooco' (Combo Offer).
if (isset($cart_item['data']) && 'wooco' === get_post_meta($cart_item['data']->get_id(), '_product_type', true)) {
// Disable quantity input field by returning a hidden input field.
return '<input type="hidden" name="cart[' . esc_attr($cart_item_key) . '][qty]" value="' . esc_attr($cart_item['quantity']) . '" />';
}
return $product_quantity;
}
but without useful