Empty variable

I have the following problem:

I’m mapping a variable, but it may be empty, but this error is appearing.

Captura de Tela 2024-04-22 às 17.03.16

How do I continue the flow even though the variable is empty?

Captura de Tela 2024-04-22 às 17.36.49

Did you check if you have any data in your array “meta data”

If you have data in that and then you are getting this error. It means your function is wrong.

@Murilo i am not aware of your functions experience. But i always try to validate my function one by one.

Princy Jain
Make consultant,
For consulting support: Follow up Automated


Hi Prince.
Thank you for your help.

Yesterday I ran some tests, and the problem is not because the variable is empty, but because in some requests the variable is not present, and that’s why the error occurs.

I need to find a way for when this variable is not present, the flow understands that it is empty and does not give this error.

Can you help me with this?

@Murilo well meta data is missing. So this should be woocommerce internal thing .

Check in WooCommerce module, can you see output missing?


Do you only want to continue if the Mata Data array exists? Then you can add a filter like this after the module:

If you only want to adjust the function, I would suggest to test with the if() function.
You can try something like {{if(length(2.Meta Data) + ">0"; "your formula"; null)}}


No, on the contrary, I want to continue the flow even though Meta Data does not exist. I receive requests that will have Meta Data and requests that will not have Meta Data. In both cases, the flow cannot present an error.

With yohr meta data variable use ifempty function. And see if you can pass with empty array or some random test array


I actually think the error is because of the toArray() function you are using.
This tries to create an Array of just 1 value which will not work.
You can check your output with the first()-map() function combination. You will not receive an error if the meta data array does not exist, but an empty value.
If you want to create an Array of this 1 value, you can use the add() function. This will output an empty array if the Meta Data does not exist.


How would it look using the Add() function.
Would I use it along with the other functions?

{{add(first(map(2.metaData; “value.1.1.WooCommerceEventsSeatingFields”; “key”; “WooCommerceEventsOrderTickets”)))}}

I found a solution, but I had to use two Tools modules, I don’t know if it’s possible to do it in the same module or using other functions.

Captura de Tela 2024-04-23 às 10.52.41
Captura de Tela 2024-04-23 às 10.55.16

yes, you have to use in combination with your other functions, e.g.:

{{add(emptyarray; first(map(2.metaData; “value.1.1.WooCommerceEventsSeatingFields”; “key”; “WooCommerceEventsOrderTickets”)))}}

This didn’t work, or am I doing it wrong?

Captura de Tela 2024-04-23 às 11.31.01

you have to use the ‘variable’ emptyarray (instead of entering the text yourself)
image 2024-04-23 at 17.12.58


AutoPilot, thank you very much!

Worked perfectly.

Captura de Tela 2024-04-23 às 22.20.19