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)”, consult_slot_usage=”0|1″.  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. The parameter for consulting slot usage (default=0) controls whether the availability of slots should be taken into account or not.

Conditional shortcodes

Posted in: WooCommerce Opening Hours and Delivery Times