DIfferent Pick-up opening hours in functions.php

WPPizza – A Restaurant Plugin for WordPress Support General Support DIfferent Pick-up opening hours in functions.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38422

    Dear Olly,
    I’d need these opening hours:

    Delivery
    19:00-20:00 and 20:00-21:00 six day [0][1][2][4][5][6]
    and 12:00-13:00 and 13:00 – 14:00 sunday and saturday [0][6]

    Pick-up
    12:00-22:00 every day [0][1][2][4][5][6]

    Wednesday closed [3]

    I set in WPPizza Open Page this:

    then I added to theme functions (wp-content/themes/x-child/functions.php) following lines:

    
    add_action('wppizza_on_pickup_delivery_change', 'myprefix_openinghours_on_pickup');
    function myprefix_openinghours_on_pickup($is_pickup){
    global $wppizza_options;
    /* change opening times if pickup is selected */
    if($is_pickup){
    /* mondays */
    $wppizza_options['openingtimes']['opening_times_standard'][1]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][1]['close'] = '22:00';
    /* tuesdays */
    $wppizza_options['openingtimes']['opening_times_standard'][2]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][2]['close'] = '22:00';
    /* wednesdays */
    $wppizza_options['openingtimes']['opening_times_standard'][3]['open'] = '00:00';
    $wppizza_options['openingtimes']['opening_times_standard'][3]['close'] = '00:00';
    /* thursdays */
    $wppizza_options['openingtimes']['opening_times_standard'][4]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][4]['close'] = '22:00';
    /* fridays */
    $wppizza_options['openingtimes']['opening_times_standard'][5]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][5]['close'] = '22:00';
    /* saturdays */
    $wppizza_options['openingtimes']['opening_times_standard'][6]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][6]['close'] = '22:00';
    /* sundays */
    $wppizza_options['openingtimes']['opening_times_standard'][0]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][0]['close'] = '22:00';
    }
    }
    add_filter('wppizza_filter_force_pickup_toggle_display', 'my_prefix_force_pickup_toggle');
    function my_prefix_force_pickup_toggle(){
    return true;
    }
    

    But at toggle Pickup / Delivery order page pickup hours are the same of delivery.

    Could You help me please?

    Thanks!

    [edit by admin: please wrap code in code tags in the future]

    #38433

    Hi Olly,

    if I put

    <?php
    // =============================================================================
    // FUNCTIONS.PHP
    // -----------------------------------------------------------------------------
    // Overwrite or add your own custom functions to X in this file.
    // =============================================================================
    add_action('wppizza_on_pickup_delivery_change', 'myprefix_openinghours_on_pickup');
    function myprefix_openinghours_on_pickup($is_pickup){
    global $wppizza_options;
    /* change opening times if pickup is selected */
    if($is_pickup){
    /* mondays */
    $wppizza_options['openingtimes']['opening_times_standard'][1]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][1]['close'] = '22:00';
    /* tuesdays */
    $wppizza_options['openingtimes']['opening_times_standard'][2]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][2]['close'] = '22:00';
    /* wednesdays */
    $wppizza_options['openingtimes']['opening_times_standard'][3]['open'] = '00:00';
    $wppizza_options['openingtimes']['opening_times_standard'][3]['close'] = '00:00';
    /* thursdays */
    $wppizza_options['openingtimes']['opening_times_standard'][4]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][4]['close'] = '22:00';
    /* fridays */
    $wppizza_options['openingtimes']['opening_times_standard'][5]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][5]['close'] = '22:00';
    /* saturdays */
    $wppizza_options['openingtimes']['opening_times_standard'][6]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][6]['close'] = '22:00';
    /* sundays */
    $wppizza_options['openingtimes']['opening_times_standard'][0]['open'] = '12:00';
    $wppizza_options['openingtimes']['opening_times_standard'][0]['close'] = '22:00';
    unset(wppizza[openingtimes][times_closed_standard]);
    }
    }
    add_filter('wppizza_filter_force_pickup_toggle_display', 'my_prefix_force_pickup_toggle');
    function my_prefix_force_pickup_toggle(){
    return true;
    }

    I get blank page, same with alternative

    #38434

    ok, thanks

    #38436
    Olly
    Admin & Mod

      I’ve deleted my previous replies (only confuses the issue) and updated the documentation here instead

      https://docs.wp-pizza.com/developers/?section=pickup-opening-times

      (as there were some parts to it missing that makes this work in different scenarios)

    Viewing 4 posts - 1 through 4 (of 4 total)
    • The topic ‘DIfferent Pick-up opening hours in functions.php’ is closed to new replies.