WPSlash

How to Redirect to Specific Page based on Availability Checker on WooFood Multistore

Monday April 13, 2020

Hi,

Here are two small snippets allows you to redirect the customer to the page url you want after available stores has been found using Availability Checker .

This snipper is useful if for example you have 4 locations and each location has independent menu and you want to use a different menu for each one.

So, after customer checking using the Availability Checker or Change his Address will redirected also automatically to the correct menu page.

The first snippet is to enable redirection

add_filter('woofood_multistore_redirect_after_store_found', 'wpslash_enable_availability_redirect');

function wpslash_enable_availability_redirect($bool)
{

return true;
}

The second snippet is to set the url we want for redirection depended on the available store we have . As you can see the second argument we have is $available_stores containing info about the stores Availability Checker found Available.

add_filter('woofood_multistore_redirect_url', 'wpslash_availability_redirect_url', 10, 2);

function wpslash_availability_redirect_url($page_url, $available_stores)
{
	if($available_stores["nearest_store_name"] =="Location 1")
	{
		$page_url ="https://yourwebsite.com/menupage1/";
	}
	elseif($available_stores["nearest_store_name"] =="Location 2")
	{
		$page_url ="https://yourwebsite.com/menupage2/";

	}
	return $page_url;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Articles

WooFood

How to Disable Coupons for Delivery Orders in WooCommerce

If you’re running a WooCommerce-powered restaurant or food delivery service, you might want to restrict certain coupon codes for delivery orders while keeping them valid for pickup orders. This ensures better control over discounts, prevents misuse, and improves your store’s pricing strategy. Why Restrict Coupons for Delivery Orders? Offering coupons is a great way to attract customers, but in food […]
June 20, 2023
WooFood

How to Automatically Re-Enable Disabled Products in WooFood Once a Day

If you’re running a WooCommerce-powered restaurant ordering system using WooFood, you might have products that automatically get disabled due to stock limits or availability settings. To ensure a smooth customer experience, you can automate the re-enabling process using a scheduled WordPress cron job. This method allows you to reset all product availability once a day, ensuring your menu stays active without manual intervention. Why […]
March 8, 2023
WooFood

How to Add Live Product Search to WooFood in WooCommerce

Enhancing the user experience of your WooCommerce-powered restaurant ordering system is crucial, and adding a live product search feature can significantly improve navigation. This feature allows customers to quickly find food items in your WooFood-powered menu without manually browsing through categories. In this article, we’ll show you how to integrate a live product search above the accordion menu in WooFood using a simple jQuery script and PHP snippet. […]
December 29, 2022