Woocommerce阻止购物车页面隐藏购物车中特定产品id的数量字段

Woocommerce阻止购物车页面隐藏购物车中特定产品id的数量字段,woocommerce,field,block,cart,Woocommerce,Field,Block,Cart,我一直在为购物车页面使用WooCommerce Blocks插件,我正在尝试使用一个代码片段对其进行轻微修改。 我发现这段代码在普通的woo cart页面上非常有效,但我真的希望它能在woo cart页面上运行: add_filter( 'woocommerce_quantity_input_args', 'hide_quantity_input_field', 20, 2 ); function hide_quantity_input_field( $args, $product ) {

我一直在为购物车页面使用WooCommerce Blocks插件,我正在尝试使用一个代码片段对其进行轻微修改。

我发现这段代码在普通的woo cart页面上非常有效,但我真的希望它能在woo cart页面上运行:

add_filter( 'woocommerce_quantity_input_args', 'hide_quantity_input_field', 20, 2 );
function hide_quantity_input_field( $args, $product ) {
    // Here set your product IDs in the array
    $product_ids = array(46);

    // Handling product variation
    $the_id = $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();

    // Only on cart page for a specific product category
    if( is_cart() && in_array( $the_id, $product_ids ) ){
        $input_value = $args['input_value'];
        $args['min_value'] = $args['max_value'] = $input_value;
    }
    return $args;
}
我已经试过改变优先顺序了。。有什么建议吗