WooCommerce Opening Hours and Delivery Times FAQs

WooCommerce Opening Hours and Delivery Times

How can I customise the plugin’s behaviour or particular messages?

Beyond the settings (which you can find in WooCommerce -> Settings -> General in your dashboard), the plugin has many hooks for WordPress developers to use, which allow editing both of the plugin’s behaviour and of any particular messages it shows the customer.

As well as discovering them through inspection of the code, developers can find them described under the “Developer’s Information” section on the product page, together with examples and a link to a tutorial. Go to that section to see how it’s done.

Please note that your purchase of the plugin does not include the cost of providing customisations for you.

What versions of WooCommerce and WordPress does the plugin support?

We support WordPress 3.2 onwards, and WooCommerce 2.1 onwards. We will always support the latest versions. Please do make sure that you are running the current, and not an out-dated, version of our plugin before requesting support from us.

How can I configure an opening time that spans midnight?

If you are open from before midnight until after it, then you should enter two separate sets of opening hours: one that ends at midnight (which is entered as 24:00), and the second of which begins at the start of the next day (entered as 00:00), as in this screenshot (in which the shop is open from 8pm until 4am the next day):

Spanning midnight

Where do I download the plugin from?

You should have been shown a download link immediately after purchase; the link is also in your order receipt email. If you have not got either of those, then you can download it from your account page, here.

How can I make the time selection to use drop-downs instead of sliders?

This is done via a WordPress filter. You can find this and other possible modifications described under the “Developer’s Information” section on the product page, together with examples and a link to a tutorial.

In this case, the PHP code snippet involved is:

add_filter('openinghours_timepickercontroltype', 'my_openinghours_timepickercontroltype');
function my_openinghours_timepickercontroltype($t) { return 'select';}

How do I apply a cut-off time for next-day service (but allow them to choose any time the next day)?

To do this, you will need version 1.5.18 or later of the plugin (October 2015). This adds a new capability to make the “minimum order fulfilment time” vary, depending upon what the time is now, and adds the ability to make that clock not start ticking until the shop first opens. This opens up all kinds of possibilities – some of which would make little sense, but others do!

In this example, we have a shop that customers can collect orders from at any time from 10.00am to 6.30pm (i.e. 10:00 until 18:30, on the 24-hour clock). The shop owner wants people to be able to pick up from the next day onwards, at any time, but only if they order before 18:30. If you order after 18:30, then you can’t pick up the next day, and will need to wait until the day after that.

To do that, you need a minimum order fulfilment time that:

  • Does not allow any times to be chosen from ‘today’ in any case
  • Does allow you to choose a time from tomorrow, as long as it’s not yet 18:30.

To do that, you:

  1. Enter a minimum order fulfilment time that equals the length of time that the shop is open during the day – which is 8 hours and 30 minutes = 8*60 + 30 = 510 minutes. (This will mean that the first criteria above is partially fulfilled – it’ll hold as long as the time today has reached opening time).
  2. Choose the option to “Count the minimum fulfilment time beginning from the time that the customer is ordering”. This now causes the first criteria above to be fully fulfilled.
  3. Enter 18:30 in the “if the time has gone past” box, and enter the number of minutes from 18:30 until 10:00 the next day as the number of minutes to then add on – which is 15 hours and 30 minutes = 15*60 + 30 = 930. This fulfils the second criteria – if the time today is after 6:30pm, then the minimum order time will now take them beyond 6:30pm the next day, meaning that their possible times aren’t until the day after the next day.

All this will look like this:

Cut-off time for next-day delivery

How can I put the plugin into “date-only” mode, so that it does not show times to customers?

You can do this by adding a line to your wp-config.php file, after the opening <?php near the top:

define('OPENINGHOURS_DATEONLY', true);

Alternatively, you can use a WordPress filter – add this to your functions.php, or wherever you add filters:

add_filter('openinghours_date_only', '__return_true');

How do I make it so that the default choice is blank (i.e. no time chosen by default)?

You can do this using the openinghours_frontend_initialvalue filter in an mu-plugin.

i.e.

Place a file in wp-content/mu-plugins/no-initial-value.php (you may need to create the mu-plugins directory if it does not yet exist):

<?php
add_filter('openinghours_frontend_initialvalue', '__return_empty_string');
add_filter('openinghours_frontend_initialvalue_formethod', '__return_empty_string');

How can I show some content only if the shop is open/closed?

A shortcode, [openinghours_conditional only_if=”(open|closed)”], is available.

Content contained inside the opening and shortcode tags will only render if the shop is open/closed, according to your default opening hours (i.e. it does not depend upon considerations of category, or minimum order fulfilment times).

e.g.

[openinghours_conditional only_if=”closed”]The shop is closed now.[/openinghours_conditional].

Remember that you must exclude pages with conditional content from cacheing plugins.

Further parameters are available to use the hours for a specified shipping method: shipping_method=”(shipping_method_textual_id|default)”, instance_id=”(shipping_zone_instance_id)” (applies only on WC 2.6+). The shipping method textual ID is the one used internally in WooCommerce; ask the shipping method extension author, or a PHP developer to help you, if you do not know how to find this.

Conditional shortcodes

How can I accept an empty time?

If you wish to accept an empty time from the customer, then use this code snippet as an mu-plugin (or in your functions.php):

add_filter('openinghours_check_cart_items', 'my_openinghours_check_cart_items');
function my_openinghours_check_cart_items($r) {
return empty($_POST['openinghours_time']) ? true : $r;
}

This requires version 1.6.12 or later of the plugin.

My shop has opening hours that go across midnight. How do I configure this?

If you are open past midnight, then enter two sets of opening hours (one until 24:00, the other starting from 00:00 the next day).

Hours crossing midnight

(If you close at midnight, enter that as “until 24:00”, not “until 00:00”).