Skip to content
Advertisement

Get the value of a string inside a function

so there’s this function:

JavaScript

That I would like to get the value from. Let’s say, is it 'delivery' or 'pickup'?

Then, I need to know if the product this whole code refers to is set as a 'pickup' or 'delivery' – each product is assigned to only one of these two values.

So, before I even try to validate if it matches one of these two values, I thought I’d print it out in the email I send as a test to myself… to see if it works.

The code below returns the value The order #2262 is ready for delivery!Arraytest on the emails I receive as a test:

JavaScript

As you can see, I placed the variable inside $message = 'The order #' .$payment_id. ' is ready for delivery!' .$pickup_or_delivery. 'test';

To sumarize: this code displays the words Array.

I’ve tried moving things arround for many hours and I feel I’m hitting myself against the wall. Any ideas?

Advertisement

Answer

Use following code to get “Service type” :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement