SCENARIO :
We are an online multi-restaurant delivery service :
And we need to add an extra fee if the customer orders from 2 or more different restaurants. So for each restaurant we add an extra 2€ fee.
EXAMPLES :
- customer selects 1 meal : no fee
- customer selects 2 meals from same restaurant : no fee
- customer selects 2 meals from 2 diff restaurants : 2€ extra fee
- customer selects 3 meals from 3 diff restaurants : 2€ + 2€ = 4€
- customer selects 4 meals from 4 diff restaurants : 2€ + 2€ +2€ = 6€ ... and so on
CATEGORIES :
- Each restaurant is 1 category
- Each meal has more than 1 category AND
- We need to check if this category in particular is equal or different for each meal on cart checkout
PROBLEM :
Here's what we think might work :
- We might have to scroll thru each meal (product) on cart checkout AND
- We have to get the categories for each meal AND
- Compare each meal + check if they belong to diff restaurants
Restaurants are a sub-category like :
City (top cat.) -> Restaurant (child cat.) -> Meal (product)
SOLUTION :
So we think might be easy to write some code that checks if products (meals) on cart checkout are from more than 1 category (restaurant) ? And then apply the additional fee ?
Need some help here on how to best approach this scenario. Thank you!