Adding the option for Delivery

Good Evening Guys,

I am building an app for a local restaurant. I need the ability for the customer to select either “delivery” or “collection” - I have done this using radio buttons.

When the customer selects “delivery” the delivery location field is shown. Which will show the current users location. And can be edited by customer if it needs to be amended.

this also then shows the element "Delivery Fee : £4.00 as shown here :

but im struggling being able to then charge the customer the additional £4.00 at checkout.

Here is the current checkout setup -

any help would be greatly appreciated!

Thank you

1 Like

You could use two separate ‘Charge the current user’ blocks, and use conditionals to check whether the delivery radio button is active. One block will have the extra 4£, while the other wont.
I think this is a terrible way of doing things because it makes it much harder to maintain and you will quickly get swarmed with blocks if you have a lot of different combinations of possibilities.

This is a great place to use the :format as text operator.
Radio button is checked: format as text (If Yes: Base charge + delivery, If No: Base charge):converted to number

This allows you to use a single dynamic expression to correctly format the ‘Amount’ field.
It is really cool because you can also chain :format as text operators to check multiple conditions.

1 Like

Hey thank you for coming back to me on this!

Just to confirm, would this be run on the same workflow as the purchase button as per the screenshot above?

My main question is, where does the delivery charge come from? How do i add this in? So when i add If yes: Order total + Delivery. but where does this value come from?

Thank you!

If all other steps are the same; you need to figure out, whether it include delivery charges or not.

Then: as @nico.dicagno suggested.

under the same workflow on button, in the charge the current user action on amount you can use

 Radio button value  is collection ( :format as text 
> if Yes: base charge + delivery fee
> if No: Base Charge) :converted to number 

There are a few options. The most basic one would be to hardcode a ‘4’ into the dynamic expression. As a hard coded value, you would not be able to change it.
This generally does not cut it.
What are your requirements for the delivery fee? Does it depend on distance from origin to destination? Does it depend on vendor? Can you change it?
In most cases, your delivery fee will somehow have to be saved to the database, either on a field, or as a whole new datatype. It might even be calculated on-the-fly on the page.

Hi, thanks for coming back to me. This is actually just a flat fee of £4 and isnt dependant on distance.

Thank you

I have actually created a product that is hidden, called delivery fee…
I was wondering if that would be an option. Just unsure how to implement this

Thank you

Thanks for coming back to me!

I attempted this, but getting errors. Can you please assist.

Thank you

It’s wonderful, you error you get is because of maybe not understanding us. or maybe our English is poor to guide you on what to do exactly :smiley:

you don’t need to include if YES: or IF NO: … inside each each box for :format as text case. don’t also use the format as text inside the NO. we need it to be a number only. and as the value return in each case would be considered to be a text we need to make it a number.

after the main :format as text add a :convert to number

I have actually done this, please see here:

error i am getting is : invalid payment amount : null

Hey, bro sorry for delay from my behalf. I was stuck on a personal issue.

When will you be free, i will do it for you free, i will walk you though on the process. If you like.

Ping me here or on my social platforms you can find them in my link tree:

www.linktr.ee/baloshi69