title: Warning before the checkout page
body: <pre><code>function alter_payment_gateways( $list ) {
      // Retrieve chosen shipping options from all possible packages
      $chosen_rates = ( isset( WC()-&gt;session ) ) ? WC()-&gt;session-&gt;get( 'chosen_shipping_methods' ) : array();
  
      if( in_array('betrs_shipping:2-1', $chosen_rates ) ) {
          $array_diff = array('WC_Gateway_COD');
          $list = array_diff( $list, $array_diff );
      }
      else if( in_array('betrs_shipping:2-2', $chosen_rates ) ) {
          $array_diff = array('WC_Gateway_COD');
          $list = array_diff( $list, $array_diff );
      }
      return $list;
  }
  add_action('woocommerce_payment_gateways', 'alter_payment_gateways');
  </code></pre>
  <p>I get these two warnings for this code. The code is still working but i want to solved the warnings.</p>
  <blockquote>
  <p>Warning: in_array() expects parameter 2 to be array, null given</p>
  <p>Warning: in_array() expects parameter 2 to be array, null given</p>
  </blockquote>