title: Disable payment gateway based on number of items and product category in WooCommerce cart
body: <p>I am using the following code, which allows me to set a minimal quantity of products in cart to proceed payment</p>
  <pre class="lang-php prettyprint-override"><code>// Allow order only product quantity increment
  
  function s5_unsetting_payment_gateway( $available_gateways ) {
    if ( ! is_admin() ) {
      $cart_quantity = WC()-&gt;cart-&gt;get_cart_contents_count();
  
      if ( ( $cart_quantity % 6 ) !== 0 ) {
          unset($available_gateways['cod']);
          unset($available_gateways['bacs']);
      }
    }
  
    return $available_gateways;
  }
  add_filter( 'woocommerce_available_payment_gateways', 's5_unsetting_payment_gateway', 10, 1 );
  </code></pre>
  <hr />
  <p>Is there some option to exclude some specific category?</p>
  <p><strong>For example:</strong></p>
  <p>I need to set the minimum quantity for one order for 6 pieces of goods (applies to all categories).</p>
  <p>For one category of products (ID 2), however, I want that if there are only goods from this category in the basket, set the minimum for the order to 3 pieces.</p>
  <p>Any advice?</p>