title: Disable a woocommerce delivery method on weekends and cut off time in the week
body: <p>Based on <a href="https://stackoverflow.com/questions/63946611/hide-specific-shipping-method-depending-on-day-time-in-woocommerce/63946874#63946874">Hide specific shipping method depending on day time in WooCommerce</a> answer code, I am looking to only allow Monday to Friday before 3pm.</p>
  <pre><code>//hide shipping method based on time
  add_filter( 'woocommerce_package_rates', 'hide_shipping_method_based_on_time', 10, 2 );
  function hide_shipping_method_based_on_time( $rates, $package )
  {
      // Set your default time zone (http://php.net/manual/en/timezones.php)
      date_default_timezone_set('Europe/London');
      
      // Here set your shipping rate Id
      $shipping_rate_id = 'flat_rate:29';
  
      // When this shipping method is available and after 2 PM
      if ( array_key_exists( $shipping_rate_id, $rates ) &amp;&amp; date('H') &gt; 14 ) {
          unset($rates[$shipping_rate_id]); // remove it
      }
      return $rates;
  
  }
  </code></pre>