dynamically filter options set

WPPizza – A Restaurant Plugin for WordPress Support Add-Ons Extensions Preorder Codesnippets dynamically filter options set

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

      as of version 1.4 you can dynamically change the (most) options you have set in your options settings page.

      as an example, you could have set your options to allow pre-ordering to be 3 days in advance.
      however, maybe you do NOT want to allow preordering on a friday and saturday , so you could do the following:

      
      add_filter( 'wppizza_po_filter_options_get_dates_and_times', 'myprefix_wppizza_preorder_set_advance_days_by_day' ,10 , 2 );
      function myprefix_wppizza_preorder_set_advance_days_by_day($options,$timestamp){
      $getDayOfWeek=date('N',$timestamp);
      /**do not allow preorder on friday / saturday -  outside opening hours */
      if($getDayOfWeek==5 || $getDayOfWeek==6 ){
      $options['options']['days_in_advance']=0;			
      }
      return $options;	
      }
      
    Viewing 1 post (of 1 total)
    • The topic ‘dynamically filter options set’ is closed to new replies.