Custom Fields
Support Meta Box Show Hide (Javascript) WooCommerce hide fields on product_cat ids not working

  • Creator
  • #12154

    Hey folks. i try to hide fields only on categories from Woocommerce custom post type category = product_cat - with the code below it is not working. i need to hide only fields not meta boxes.
    The product id of the Woocommerce product_cat equals 18.

    I think something is wrong here, but i can't figure out where. Can you please assist?

    In Woocommerce i also have products assigned to different product_cats and i need to hide some of the fields on one but not the other category - is that possible?

    array (
                    'id' => 'lautstaerke_minimum',
                    'type' => 'text',
                    'name' => 'Lautstärke Minimum',
                    'desc' => 'Beispiel 49 dB (A)',
                    'std' => '49 dB (A)',
                    'tab' => 'geraet',
                    '' => '',
                    'hidden' => 
                    array (
                        'when' => 
                        array (
                            0 => 
                            array (
                                0 => 'product_cat',
                                1 => '=',
                                2 => 18,
                        'relation' => 'or',
Viewing 1 replies (of 1 total)
  • Author
  • #12180
    Anh Tran


    I see you're using the syntax for Meta Box Conditional Logic instead of Meta Box Show Hide. This code is created with Meta Box Builder, which only supports Conditional Logic. So to use Show Hide, please modify the syntax to match the rules here.

    If you want to use Conditional Logic, please note that the taxonomy value is an array, so you should use in or contains, like this:

    array( 'tax_input[product_cat]', 'contains', 18 )

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.