This snippet changes the default “Select” button text on FoodMaster (formerly WooFood) product listings. Add it to your child theme’s functions.php file, or to a code snippets plugin.
Change the button text
The function returns the new label. In the example it returns “Order Now”, so replace that with the text you want on the button. Other labels the original post suggests are “Add to Order”, “Get Your Meal”, “Place Order” and “Get It Now”.
Updated for current FoodMaster versions: the code below uses the foodmaster_ names. Older installs that still run WooFood used the woofood_ prefix, so on those change foodmaster_ back to woofood_.
add_filter("foodmaster_product_add_to_cart_text_ajax", "wpslash_tweak_change_default_select_button_text", 10, 1);
function wpslash_tweak_change_default_select_button_text($default)
{
return "Order Now";
}How the snippet works
- It hooks into the
foodmaster_product_add_to_cart_text_ajaxfilter. - The function
wpslash_tweak_change_default_select_button_text()returns “Order Now” in place of the default text. - Change the returned string to any label you prefer, such as “Add to Order”.
Before you start
- Use the same button text across your whole menu.
- Test the change on a staging site before you use it on the live shop.
To check it worked, open a product listing on the front end and look at the button. It should show your new text on both desktop and mobile.
FoodMaster (formerly WooFood)
The snippet uses a filter from FoodMaster (formerly WooFood), the restaurant ordering plugin for WooCommerce. You can get FoodMaster here.
