Templates
WooCommerce Restaurant Ordering uses a similar PHP templating mechanism to that used in WooCommerce. A number of templates are used by the plugin to display the various HTML components that comprise the restaurant order forms.
Template location
All templates are included in the /templates
folder within the plugin. On your web server this location would be:
<root>/wp-plugins/woocommerce-restaurant-ordering/templates/
The templates
Within the /templates
folder you will find subfolders for the following:
cart-notice
- Controls the display of the cart notice shown at the top of the page after adding a product to the cart.menu
- Controls the display of the restaurant menu order form.modal
- Controls the display of the product lightbox (modal).
Within each of these folders are various PHP templates, some contained in further subfolders.
Overriding a template
To override a template, you need to copy the required template to your theme folder and place it in the folder /woocommerce/restaurant/
within your theme folder.
For example, if you wanted to override the name.php
template contained under the /menu/product
template folder, you would copy name.php
to your theme at this location:
/wp-content/themes/<your theme>/woocommerce/restaurant/menu/product/name.php
if you wanted to override the content.php
template contained under the /modal
template folder, you would copy content.php
from the plugin to your theme at this location:
/wp-content/themes/<your theme>/woocommerce/restaurant/modal/content.php
Underscores templates
Some of the templates used in the plugin use the Underscores template system used in WordPress and WooCommerce. These templates are loaded by the plugin Javascript and pass certain data to the templates, which is used to control the HTML output.
The templates used for the cart-notice
and modal
are Underscores templates and are loaded using the wp.template function.