"Shop is closed" on specific days

A support request came in last week asking for a simple way to lock down the shop on the specific days, as the store isn’t open and pickups aren’t possible.

While a more fool-proof solution would be to restrict this server-side with a module, you can add a simple notice with just the twig templates:

    {% if "now"|date("N") == 3 %}
        <div class="c-cart-error">
            The store is closed on Wednesday. Orders placed today can be picked up tomorrow after 11am. 
    {% endif %}

The N date filter returns a number, starting at 1 for Monday (through 7 for Sunday), so the example above shows the notice only on Wednesdays.

1 Like

Any plans to have this kind of thing as a module that clients can manage from the Manager?
A ‘holiday mode’ to turn off the ability to buy products and/or add a notice for when delivery will be available?

It’s not on the immediate roadmap, but would make a cool module for sure. :slight_smile:

I had another idea on this last week: Agenda. That’s great for managing events and I’ve previously used it to build an opening hours widget which takes advantage of recurring events.

That tutorial could probably be adapted to disable the cart (or add a notice on product pages) when the shop is closed by checking for events happening today. If no events are found, don’t show the cart.

There’s also the TimeSlots extension which would let you set up schedules for when delivery is available; with that approach you could potentially allow orders to come in during a holiday, while offering the first possible delivery date as part of the checkout.