disable pre-order between certain times

WPPizza – A Restaurant Plugin for WordPress Support Add-Ons Extensions Preorder Codesnippets disable pre-order between certain times

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9979
    Olly
    Admin & Mod

      as of version 1.4 you could use the following filter to disable pre-ordering between certain times.
      for example if you close at 15:00 and need a couple of hours (i.e from 15:00 to 17:00) to make sure you have enough stock for the next day to be able to fulfill preorders for that day
      will require php >=5.3

      
      /*no (pre)order between 15:00 and 17:00 | DateTime php >=5.3 only */
      add_filter( 'wppizza_po_filter_values', 'myprefix_wppizza_preorder_set_values' ,10 , 2 );
      function myprefix_wppizza_preorder_set_values($values,$timestamp){
      $close = DateTime::createFromFormat('H:i', '15:00')->getTimestamp();
      $open = DateTime::createFromFormat('H:i', '17:00')->getTimestamp();
      /**no order between these times*/
      if ($timestamp > $close && $timestamp < $open){
      $values['allowTimes']=array();
      }
      return $values;
      }
      
    Viewing 1 post (of 1 total)
    • The topic ‘disable pre-order between certain times’ is closed to new replies.