i would like to hide the woocommerce checkout-review-order table for specific product categories in WooCommerce cart category "X"
I'm using the code below for this, but it does not hide the table
function conditional_checkout_fields_products( $fields ) {
$cart = WC()->cart->get_cart();
foreach ( $cart as $item_key => $values ) {
$product = $values['data'];
if ( $product->id == 168 ) {
unset( $fields['order']['order_review'] );
}
}
return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'conditional_checkout_fields_products' );
//OTHER HOOK add_filter( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
Any help with that?